New in Beta 6
I talked about
try? in a separate post because it really deserves a longer discussion than quick bullet points.
Completion. Context-sensitive Xcode completion for inferred dot syntax, e.g. MyEnum.Item vs .Item, when the type is clear to the compiler. neat.
Static Computed Properties in Protocol Extensions. Yay. You can, I believe, also use required protocol members in computing those properties.
Non-Terminal Variadics. They can appear anywhere in the parameter list, enabling you to most importantly combine variadics with trailing closures.
Collection Clarity. Non-ObjC types cannot be stored within ObjC-marked properties, e.g. an Array of swift-specific enumerations. Collections containing types that are not Objective-C compatible are no longer considered Objective-C compatible types themselves. For example, previously Array<SwiftClassType> was permitted as the type of a property marked @objc. This is no longer the case. (19787270)
Block imports are now typealiases for Swift-style closures. I’ll just quote Apple: C typedefs of block types are now imported as typealiases for Swift closures. The primary result of this is that typedefs for blocks with a parameter of type BOOL are now imported as closures with a parameter of type Bool (rather than ObjCBool as in the previous beta). This matches the behavior of block parameters to imported Objective-C methods. (22013912)
Type Aliases now get an aka annotation in error messages. So you can see what they alias to for better clarity.
Print and Debug Print on Steroids. They’re now variadic and you can add a
String separator. (I wish they had called it separator and not string because better Update: they did.). Quick separate post on this. It’s really cool stuff.
public func print(items: Any..., separator: String = default, terminator: String = default) public func print<Target : OutputStreamType>(items: Any..., separator: String = default, terminator: String = default, inout toStream output: Target)
extend(). Long live
appendContentsOf(). Same bat behavior, new bat name. Time to go back and fix all my code. *shakes fist*.
All collections are Sliceable. Ginsu!
Most closure ops are rethrows-able. So you can now throw out of maps and filter, and you can try? and &&/||/?? together.