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…
Swift 1.2 and Xcode 6.3 beta
31–40 of 94 posts
Re: Swift 1.2 and Xcode 6.3 beta
#32Earlier 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.
let x: Something = if condition {
// do stuff
foo()
} else {
// do other stuff
bar()
}Re: Swift 1.2 and Xcode 6.3 beta
#33That's a nice example of "if you're not embarrassed of 1.0, you shipped too late".
Re: Swift 1.2 and Xcode 6.3 beta
#34Awesome, 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…
Re: Swift 1.2 and Xcode 6.3 beta
#35Awesome, 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.
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
#36This 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)
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
#37How 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)?
Re: Swift 1.2 and Xcode 6.3 beta
#38This 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
#39Earlier 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.
Re: Swift 1.2 and Xcode 6.3 beta
#40This 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"