Re: Do Bindings work in Swift?
Re: Do Bindings work in Swift?
- Subject: Re: Do Bindings work in Swift?
- From: Charles Srstka <email@hidden>
- Date: Mon, 27 Apr 2015 21:12:52 -0500
On Apr 27, 2015, at 8:54 PM, Rick Mann <email@hidden> wrote:
>
> In the latest Xcode 6.3.1, I've got an OS X app with a mixture of Objective-C and Swift classes, and a Storyboard-based UI.
>
> I have one table view that's bound through an NSArrayController to an array in an Objective-C class, and it seems to work as desired.
>
> I have another table view that's bound through an NSArrayController to an Obj-C NSViewController subclass, which has a property to a Swift class which has an array property. If I get the binding configuration wrong, I get errors and the window doesn't render its contents. But if I get it right, I get no errors and all the views show up, but the table is empty (however, I know the array is getting .append() called and it's populating).
>
> It seems like the binding isn't working, but I'm not sure.
>
> The Swift class subclasses NSObject.
>
> Thanks for any help!
Make sure your array property is marked as dynamic, and also that the proper KVO notifications are being sent when you update the array (whether by using the to-many KVC methods like -insertObject:in<key>AtIndex: and friends, or by calling -willChangeValueForKey: and -didChangeValueForKey:).
Charles
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden