Re: Passing a swift function to objective-c

2014-10-18 Thread Kevin Meaney
I've now found an acceptable solution. Rather than a property I've added an optional method to the protocol which then in its implementation assigns using the property, pretty much to make sure that the function/block is copied. I declared the method like so: -(void)applyMyCreateImageFunction:(

Re: Passing a swift function to objective-c

2014-10-18 Thread Kevin Meaney
Hi Roland, Thanks for the followup. I've created a proper git rep on github rather than just a gist. Most of my github reps seem to be this kind of mini demonstration project and I was trying to avoid yet another one. https://github.com/SheffieldKevin/swift-objectivec > What version of Xcode a

Re: Passing a swift function to objective-c

2014-10-17 Thread Roland King
> > let r = x.createImageOptional( nil ) > is of course let r = x.createImage( nil ) I had two properties in my test code and didn’t fix it when I copy/pasted it, sorry. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please

Re: Passing a swift function to objective-c

2014-10-17 Thread Roland King
>> >> ok this simple test works for me .. I also don’t understand the extra parens >> etc in your example. So where does your code differ from the below? Note I >> set it both with a public function and a closure, just to see if it works. > > A detail I should have included. The @property is de

Re: Passing a swift function to objective-c

2014-10-17 Thread Quincey Morris
On Oct 17, 2014, at 09:59 , Kevin Meaney wrote: > > I got the assigning to a property working when that property was declared as > part of the class, but not when it has been declared in the optional section > of a protocol. So I was able to duplicate what you did Roland. But no matter > what

Re: Passing a swift function to objective-c

2014-10-17 Thread Kevin Meaney
Thanks Roland. On 17 Oct 2014, at 00:20, Roland King wrote: > >> On 17 Oct 2014, at 6:13 am, Kevin Meaney wrote: >> >> Hi, >> >> I'm beginning to feel this above my pay grade as I can't seem to work it out. >> >> I have a framework in Objective-C. I've been writing some tests for it, and >>

Re: Passing a swift function to objective-c

2014-10-16 Thread Roland King
> On 17 Oct 2014, at 6:13 am, Kevin Meaney wrote: > > Hi, > > I'm beginning to feel this above my pay grade as I can't seem to work it out. > > I have a framework in Objective-C. I've been writing some tests for it, and > to make life fun I've been writing the tests in Swift. > > I have a pr

Passing a swift function to objective-c

2014-10-16 Thread Kevin Meaney
Hi, I'm beginning to feel this above my pay grade as I can't seem to work it out. I have a framework in Objective-C. I've been writing some tests for it, and to make life fun I've been writing the tests in Swift. I have a property of a class in the objective-c framework declared like so: @prop