[Q] Cocoa class delegates

Moderators: LCMark, LCfraser

Post Reply
shaosean
Posts: 878
Joined: Thu Nov 04, 2010 7:53 am

[Q] Cocoa class delegates

Post by shaosean » Wed Dec 06, 2017 5:00 pm

Is there a way of linking a delegate to a widget? If not, would using the objc_addProtocol method be the way to go about it?

LCMark
Livecode Staff Member
Livecode Staff Member
Posts: 949
Joined: Thu Apr 11, 2013 11:27 am

Re: [Q] Cocoa class delegates

Post by LCMark » Wed Dec 06, 2017 8:12 pm

@shaosean: Ali and I are working on it :)

It should be possible to do from LCB by using the objc runtime API (things like objc_addProtocol), however, it would be very fiddly (and not general, you'd have to write code to create a delegate on a per-delegate basis as you would need to write wrappers explicitly for each method signature you need) - indeed, the time it would take me to try and then to explain is probably more than it will take to finish the in-engine implementation that Ali and I have been working on. Its the last missing piece of Obj-C FFI, so its high priority (we need it to finish the Map widget on iOS).

The support will be present in the next 9 DP (which we're trying to get out the door asap!).

shaosean
Posts: 878
Joined: Thu Nov 04, 2010 7:53 am

Re: [Q] Cocoa class delegates

Post by shaosean » Wed Dec 06, 2017 9:08 pm

Just to make sure I'm clear, this will be for iOS and macOS?

I've used the objc_ methods before, tis not fun, so will be awaiting the next DP :)

livecodeali
Livecode Staff Member
Livecode Staff Member
Posts: 128
Joined: Thu Apr 18, 2013 2:48 pm

Re: [Q] Cocoa class delegates

Post by livecodeali » Wed Dec 06, 2017 10:54 pm

Yep, for both :D

shaosean
Posts: 878
Joined: Thu Nov 04, 2010 7:53 am

Re: [Q] Cocoa class delegates

Post by shaosean » Wed Dec 06, 2017 10:59 pm

Quit replying and get coding!! ;-)

Post Reply

Return to “LiveCode Builder”