• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
re Swift 2.0
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Subclassing a Subclass of SBApplication
  • Next by Date: Bridging CFArrayRef and NSArray
  • Previous by thread: Re: Subclassing a Subclass of SBApplication
  • Next by thread: Bridging CFArrayRef and NSArray
  • Index(es):
    • Date
    • Thread