Live data from Hacker News

Swift 1.2 and Xcode 6.3 beta

developer.apple.com

31–40 of 94 posts

Re: Swift 1.2 and Xcode 6.3 beta

#31
post #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 bi…

Thanks.

Re: Swift 1.2 and Xcode 6.3 beta

#32

Earlier quoted context omitted.

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.

Sad that Swift doesn't use an expressive if, then you could just write:

    let x: Something = if condition {
        // do stuff
        foo()
    } else {
        // do other stuff
        bar()
    }

Re: Swift 1.2 and Xcode 6.3 beta

#34
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…

If let (and optionals in general) is my favorite Swift feature and has immediately made my code 10x more stable from the get-go. Glad to see it get expanded like this.

Re: Swift 1.2 and Xcode 6.3 beta

#35
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…

If let (and optionals in general) is my favorite Swift feature and has immediately made my code 10x more stable from the get-go. Glad to see it get expanded like this.

I'd like to see them expand it the way Rust did: Rust lifted `if let` from Swift (I believe) but made it a more general-purpose refutable pattern matcher, it's just one step below match and works with any enum type not just Option. So you can write:

    enum Foo {
        Bar,
        Baz(i32),
        Qux(f64)
    }

    if let Bar = item {
        // do something
    } else if let Baz(val) = other {
        // do something with val
    }
which is oft shorter than a full-blown `match`, and more convenient when alternating on different "source" items.

Re: Swift 1.2 and Xcode 6.3 beta

#36
post #3

This is practical. It's something you wish for within a couple hours of Swift. let x : SomeThing if condition { x = foo() } else { x = bar() } use(x)

so, in c++ you can do initialization of const value via lambda closures that are immediately evaluated:

    const int a = [=](){ 
        //do stuff here that returns an int:
        if (condition) { return foo(); } else { return bar(); }
    }();
Does this idiom work in swift?

Re: Swift 1.2 and Xcode 6.3 beta

#37

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)?

Stop it with the "open and porting". They are not going to do it.

Re: Swift 1.2 and Xcode 6.3 beta

#38
post #36
post #3

This is practical. It's something you wish for within a couple hours of Swift. let x : SomeThing if condition { x = foo() } else { x = bar() } use(x)

so, in c++ you can do initialization of const value via lambda closures that are immediately evaluated: const int a = [=](){ //do stuff here that returns an int: if (condition) { return foo(); } else { return bar(); } }(); Does this idiom work in swift?

[deleted]

Re: Swift 1.2 and Xcode 6.3 beta

#39

Earlier quoted context omitted.

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.

Still, as I remember, the release notes were still only presented to developers.

Re: Swift 1.2 and Xcode 6.3 beta

#40
post #36
post #3

This is practical. It's something you wish for within a couple hours of Swift. let x : SomeThing if condition { x = foo() } else { x = bar() } use(x)

so, in c++ you can do initialization of const value via lambda closures that are immediately evaluated: const int a = [=](){ //do stuff here that returns an int: if (condition) { return foo(); } else { return bar(); } }(); Does this idiom work in swift?

    let x: String = {
       if 3 == 4 {
          return "Hello"
       } else {
          return "Goodbye"
       }
    }()
Although in this case, I'd just use ternary.

    let x = (3 == 4) ? "Hello" : "Goodbye"
Post reply on HN