Here is the code
view.addObserver(self, forKeyPath: "center", options: .New, context: nil)
override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer<Void>) {
guard let change = change else {
return
}
print(change)
guard let newCenter = change["new"] else {
return
}
print(newCenter.dynamicType)
}
And the output is :
["new": NSPoint: {50, 50.5}, "kind": 1]
NSConcreteValue
I don't know why NS class will appear in iOS. How to correctly observe view.center/frame/transform using KVO with swift?