Xcode 9
Theres a wealth of goodies in this update. Here are some of my favorite ones
Range properties marked as IBInspectable now appear in the inspector. (31337282)
@IBInspectable var range: NSRange = NSRange(location: 0, length: 2)
They added NSRange as an ibinspectible. I made the mistake of thinking it would be Swift’s Range struct which would allow things like 0..<2, but they actually meant Obj-c’s NSRange
Interface Builder now supports connecting outlets and actions to a Swift file when the destination’s type is a protocol-typed class. (17023935)
This feature has been missing for quite some time. A delegate property written in swift would not be connectable.
Named colors that appeared as black in the Interface Builder canvas now render correctly. (32582637)
In previous versions of Xcode, setting a color in Interface build meant that the color would be saved as an RGB value in xcode. However, now we are able to create a Color Asset which Interface builder can reference just like it can reference an image.
var i = 10switch i {
case ..<10: print("less then 10")
case 4...: print("4 and up")
default: print("")
}
import SQLite3
sqlite is now available to swift! Although a quick look, shows that the api is in no way optimized for swift.
The new compiler flag -Wunguarded-availability warns for unguarded uses of Objective-C APIs that were introduced in a system whose version is newer than the deployment target version. A new Objective-C expression @available has been introduced to perform system version checking at runtime. An if statement with an @available condition can be used to guard uses of newer APIs:
if (@available(macOS 10.13, iOS 11, *)) {
// The compiler will not warn about uses of APIs from macOS 10.13
// or iOS 11 here}
Objective-c now has availability checks! A welcome addition to the language!