>>>>>>>
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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to