This is a section of my code:
if let newValue = change?[NSKeyValueChangeNewKey] {
print("\(newValue)")
faceBounds = newValue as? CGRect
print("\(faceBounds)" + " in controller")
dispatch_async(dispatch_get_main_queue(),{ () -> Void in self.updateFaceRectView()})
}
where "faceBounds" is a CGRect? type.
However, this is the output from the system I got:
NSRect: {{116.24999, 337.49997}, {86.249992, 86.249992}}
nil in controller
What is happening? Why isn't "faceBounds" getting the correct value?
[UPDATE]
Tried this too,
if let newValue = change?[NSKeyValueChangeNewKey] {
var str: String?
str = newValue as? String
print("\(str)")
// Still prints nil
}
Is my knowledge with using casting wrong?
And btw if anyone's wondering, newValue is an AnyObject type.