Re: [swift-users] Swift in bare-metal embedded programming/Swift runtime

2016-08-11 Thread Slava Pestov via swift-users
Even if you take care not to create class instances, the compiler emits many calls to runtime functions to implement features such as generics, casts and existentials. It is possible to write code where a large number of runtime calls are optimized away, but I don’t think they can be eliminated

[swift-users] NSData vs Data in swift 3

2016-08-11 Thread CK TUNG via swift-users
Anyone know where to get the updated guide on Binary Data in swift 3? The only thing I know from WWDC video is that "NSData" is reference type and the "Data" is value type and they have different methods of init rules and to getbytes or copybytes. Any idea on the motivation to have new Data cl

Re: [swift-users] in-app purchase coding

2016-08-11 Thread Brent Royal-Gordon via swift-users
> On Aug 10, 2016, at 1:10 PM, developer--- via swift-users > wrote: > > I really feel ripped off. I chose to learn to develop for iOS for particular > reasons, and now at the end of school, I’m about to graduate without having > been taught an obviously vital skill that a developer should abs

Re: [swift-users] XCTest from repl

2016-08-11 Thread Lou Zell via swift-users
Thanks Brian! You pointed me in the right direction. I've got a working version up here: https://gist.github.com/lzell/3a4f43d00657a347363343c035e5db4c Non-pretty version: // Start repl with: // $ xcrun swift -F /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer

[swift-users] Problem exporting a custom 2.2 toolchain

2016-08-11 Thread Marcel Rebouças via swift-users
Hello everybody, I've been trying to generate a custom toolchain from the version 2.2.1 to use with Xcode 7. I download every repository needed to build, and set them to the 2.2 branch (i.e. swift-2.2-branch). Then, I used the command explained at the end of this thread: https://github.com/apple/

Re: [swift-users] Defer with local variable's state

2016-08-11 Thread Sebastian Hagedorn via swift-users
My bad. After double-checking my code, I realized that some branches were dispatching their work, which of course breaks that model. Sorry, and thanks for clarification that this is how it should works. > On 11 Aug 2016, at 17:39, Joe Groff wrote: > >> >> On Aug 11, 2016, at 7:16 AM, Sebasti

Re: [swift-users] Defer with local variable's state

2016-08-11 Thread Joe Groff via swift-users
> On Aug 11, 2016, at 7:16 AM, Sebastian Hagedorn via swift-users > wrote: > > We often write code that returns early, but has to make sure a bit of code > (e.g., a completion handler) is always called whenever we return, which seems > like a great use case for defer. I started to write this:

[swift-users] Defer with local variable's state

2016-08-11 Thread Sebastian Hagedorn via swift-users
We often write code that returns early, but has to make sure a bit of code (e.g., a completion handler) is always called whenever we return, which seems like a great use case for defer. I started to write this: func execute(with completion: ((Bool) -> Void)?) { var success = false

Re: [swift-users] How to get Swift 2.3 in command line?

2016-08-11 Thread Zhao Xin via swift-users
Thank you Keith. You helped me a lot. I finally got it work. As realm use "xcrun swift" to get swift version. I did that by 'export TOOLCHAINS=com.apple.dt.toolchain.Swift_2_3'. I also think the document in https://swift.org/download/#using-downloads should change $ export > PATH=/Library/Develo