OSDN Git Service

Timerをクロージャ方式にした
[kcd/KCD.git] / KCD / NSObjectExtension.swift
1 //
2 //  NSObjectExtension.swift
3 //  KCD
4 //
5 //  Created by Hori,Masaki on 2017/03/22.
6 //  Copyright © 2017年 Hori,Masaki. All rights reserved.
7 //
8
9 import Foundation
10
11 extension NSObject {
12     
13     func notifyChangeValue(forKey key: String) {
14         
15         willChangeValue(forKey: key)
16         didChangeValue(forKey: key)
17     }
18     
19     func notifyChangeValue(forKey key: String, change f: () -> Void) {
20         
21         willChangeValue(forKey: key)
22         f()
23         didChangeValue(forKey: key)
24     }
25 }