Live data from Hacker News

Swift 1.2 and Xcode 6.3 beta

developer.apple.com

21–30 of 94 posts

Re: Swift 1.2 and Xcode 6.3 beta

#21
post #4

Earlier quoted context omitted.

short of having a language mechanism for doing an 'uninitialized' let, conditional operators could work: let x : Something = condition ? foo() : bar() but yeah, it would be nice to defer initialization of an immutable.

often times you want to do more stuff in either case so ? does not always work. The if-else approach is more general.

You could also do this:

    let x: Something = {
      if condition {
        someSideEffect()
        return foo()
      } else {
        anotherSideEffect()
        return bar()
      }
    }()
But it's kind of ugly.

Re: Swift 1.2 and Xcode 6.3 beta

#22

How about opening Swift compiler source code (and porting it to other platforms?) And, what are the OS requirements for xcode 6.3? Is it possible to install it to old macosx system (snow leopard, for example)?

It says this release (6.3) requires Yosemite (but includes SDKs for 10.9 and 10.10). For the record, 5.x doesn't even run on Snow Leopard.

Re: Swift 1.2 and Xcode 6.3 beta

#23
post #17

This is so strange. Right now we have iOS 8.2 beta and 8.3 beta XCode 6.2 beta and 6.3 beta How is the release cycle going to work? When will 8.2 and 8.3 come out and which is more stable for Swift work.

Xcode 6.2 basically only exists for the Apple Watch. I think iOS 8.2 is similar, but I'm less familiar there. Xcode 6.2 has no significant Swift changes that I'm aware of, so if you're just looking at Swift, you should either use the latest public 6.1 release, or the 6.3 beta to get the newer stuff. The release timing will presumably be that .2 comes out with the watch whenever that ends up being, and .3 will be a bit later.

Re: Swift 1.2 and Xcode 6.3 beta

#24
post #20
post #5

Earlier quoted context omitted.

Let's hope you don't have a baz.

you can torture the logic further: let x : Something = outer_conditional ? baz() : conditional ? foo() : bar()

I think this can look pretty nice, properly formatted:

    let x = conditional1 ? bar() :
            conditional2 ? baz() :
            conditional3 ? quux() :
            someDefault

Re: Swift 1.2 and Xcode 6.3 beta

#26
Awesome, the ability to unwrap multiple optionals on one line should be bolded, underlined and all caps at the top of this article. Seriously though, this is an everyday pain point that happens all the time when writing Swift. Glad Apple is listening to developer feedback on this stuff.

Translation for those unfamiliar with Swift: Swift has a relatively strong type system. If a variable in Swift can be null at any point, it must be explicitly declared so as part of its type (e.g. an integer that can be null has the type "Int?", an integer that cannot be null has the type "Int").

Swift has a way to 'unwrap' these optional values and do things with them if they exist. Prior to this release, unwrapping multiple optional things required a bunch of nested if statements. With this release, unwrapping multiple optional values can be done in one if statement.

Re: Swift 1.2 and Xcode 6.3 beta

#27
Really happy to see this, was worried we'd have to wait for WWDC for further improvements. For me personally, it's nice to see Swift support for GLKMatrix and GLKVector now, which was an issue I just ran into just a few weeks ago.

Re: Swift 1.2 and Xcode 6.3 beta

#28

How about opening Swift compiler source code (and porting it to other platforms?) And, what are the OS requirements for xcode 6.3? Is it possible to install it to old macosx system (snow leopard, for example)?

Shouldn’t Apple finish designing the language before they even consider porting it elsewhere?

Re: Swift 1.2 and Xcode 6.3 beta

#29

Earlier quoted context omitted.

Because Apple chooses to only give access to betas and their release notes to registered developers.

How does that benefit Apple?

For Yosemite they did an open beta: https://appleseed.apple.com/sp/betaprogram

But in that case, it makes sense to get bug reports from non-developers.

Re: Swift 1.2 and Xcode 6.3 beta

#30
post #26

Awesome, the ability to unwrap multiple optionals on one line should be bolded, underlined and all caps at the top of this article. Seriously though, this is an everyday pain point that happens all the time when writing Swift. Glad Apple is listening to developer feedback on this stuff. Translation for those unfamiliar with Swift: Swift has a relatively strong type system. If a variable in Swift can be null at any po…

The nested if-let statements of doom have been one of my major annoyances -- so glad to hear unwrapping multiple optionals in a single line landed in 1.2.

The "wrapping the optionals in a tuple and using switch to pattern match" hack always seemed dirty, and this is a huge step in the right direction for code readability.

Post reply on HN