re Swift 2.0
re Swift 2.0
- Subject: re Swift 2.0
- From: Michael de Haan <email@hidden>
- Date: Mon, 29 Jun 2015 05:23:39 -0700
>>>>>>>
var currentValue = 1
let newNewGenerator = anyGenerator
{
()->Int? in
let previousValue = currentValue
currentValue *= 2
return ( previousValue > 20 ) ? nil : previousValue
}
let newGeneratedArray = Array( newNewGenerator )
For some reason you have to specify block signature, doesn’t seem to be able to work it out despite the example showing it should and your second example showing it does. The ‘_’ in the ‘()->_’ is usually a hint it’s a bit confused.
<<<<<<<<<
Thank you Roland. Beautiful!!! I got close with the block signature, in my many attempts , but always had it “generic” which I now realize needed to be more specific.
_______________________________________________
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