SWIFT - KVO in xcode 6 beta 6 .. observValueForKeyPath is no longer called

I have been debugging my app from beta 3 to beta 6

I can't seem to get watchValueForKeyPath to be called .. I set a breakpoint at the top of the function and nothing happens

self.gameScene.viewController.joystick.addObserver(self, forKeyPath: "relativePosition", options: .New, context: nil)

override func observeValueForKeyPath(keyPath: String!, ofObject object: AnyObject!, change: [NSObject : AnyObject]!, context: UnsafeMutablePointer<Void>) {

    if keyPath == "relativePosition" {
    // some code here 
    }
}

      

this code worked flawlessly before .. something changed? I can't even get this to work in a more basic application .. is there something else I need to do?

+3


source to share


1 answer


the property should now have the word "dynamic" in front of it.



dynamic var relativePosition: CGPoint = CGPointZero

      

+11


source







All Articles