Upgrade to Pro — share decks privately, control downloads, hide ads and more …

What's new in Swift 2.0

What's new in Swift 2.0

9949ea4cd54bd477e21ab3273a7b7186?s=128

Mark Wilkinson

March 30, 2016
Tweet

Transcript

  1. SWIFT 2.0 WHAT’S NEW WITH

  2. FIRST 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 first-class citizenry enforced even more
  3. SWIFT 1.2 BETTER OPTIONAL BINDING

  4. SWIFT 1.2 UPCASTS AND DOWNCASTS

  5. SWIFT 1.2 LET CONSTANTS

  6. SWIFT 1.2 NULLABILITY ANNOTATIONS FOR BETTER OBJ-C TO SWIFT ▸

    nonnull, nullable, null_unspecified ▸ 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.
  7. SWIFT 1.2 NULLABILITY ANNOTATIONS CONTINUED…

  8. SWIFT 2.0 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
  9. SWIFT 2.0 PROTOCOL EXTENSIONS

  10. SWIFT 2.0 PROTOCOL EXTENSIONS CONTINUED…

  11. SWIFT 2.0 YES YOU CAN OVERRIDE THE DEFAULT

  12. SWIFT 2.0 ERROR HANDLING

  13. SWIFT 2.0 GUARD STATEMENT

  14. SWIFT 2.0 API AVAILABILITY

  15. SWIFT 2.0 JUMP TO INTERFACE

  16. SWIFT 2.0 CONVERT YOUR OBJ-C APPS NOW