WHAT’S NEW WITH
WHAT SWIFT 1.2 BROUGHT
▸ Speed enhancements, optimization in the runtime.
Original issue with swift vs. obj-c
▸ if-let pyramids of doom deprecated
▸ Upcasts and Downcasts with as adds some optional safety
▸ Native Set added to the collection types
▸ let constants don’t have to be set at declaration
▸ Swift ﬁrst-class citizenry enforced even more
BETTER OPTIONAL BINDING
UPCASTS AND DOWNCASTS
NULLABILITY ANNOTATIONS FOR BETTER OBJ-C TO SWIFT
▸ nonnull, nullable, null_unspeciﬁed
▸ originally anything in the Cocoa API returned to swift an
unwrapped optional (AnyObject!)
▸ potentially bad if nothing was there, no way to know!
crashed at runtime!
▸ much easier to handle things like UIKit with methods that
will return optionals or guaranteed instances.
NULLABILITY ANNOTATIONS CONTINUED…
SWIFT 2.0 IS HERE
▸ Protocol extensions, default method implementations
inside a protocol
▸ Error Handling, we now have throw, try, and catch !
▸ guard statement for better readability and early logic exit
▸ API availability statement
▸ Automatically synthesized headers
PROTOCOL EXTENSIONS CONTINUED…
YES YOU CAN OVERRIDE THE DEFAULT
JUMP TO INTERFACE
CONVERT YOUR OBJ-C APPS NOW