Swift Bindings won't work Xcode 6 Beta 5

前端 未结 3 2056
生来不讨喜
生来不讨喜 2021-01-04 08:52

I\'m doing a simple test program using bindings in Swift on OSX. Having an NSTableView, NSArrayController and a model class I try to hook them up together, but without succe

3条回答
  •  暖寄归人
    2021-01-04 09:34

    Beta 5 requires you to explicitly set your properties as dynamic in order for KVO/bindings to work:

    dynamic var firstName = "Brook"
    

    See the Dynamic declaration modifier section of the release notes for more information.

    The dynamic keyword enables KVO, proxying, and other advanced Cocoa features to work reliably with Swift declarations.

提交回复
热议问题