Swift Bindings won't work Xcode 6 Beta 5

拥有回忆 提交于 2019-11-30 18:41:55

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.

You have to select the Table View Cell and bind it's value to Table Cell View with the appropriate objectValue. I don't know how to get rid of the exclamation-mark / warning, but it works.

Are you using NSCell or NSView based tables? How you set up bindings is different for these. What you are doing looks correct for NSCell based tables.

When I set up a NSTableView today, it was a NSView based table, so I had to select the TextField and bind to "Table Cell View" with a Model Key Path "objectValue.name"

See the Table View Programming Guide for Mac: Populating a Table View Using Cocoa Bindings documentation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!