$30 off During Our Annual Pro Sale. View Details »

Swift 3 Spelunking

Greg Heo
December 19, 2016

Swift 3 Spelunking

A talk about Swift 2, Swift 3, and the future. Silicon Valley iOS Developers' Meetup, December 19, 2016.

Greg Heo

December 19, 2016
Tweet

More Decks by Greg Heo

Other Decks in Technology

Transcript

  1. Silicon Valley iOS Developers' Meetup, December 2016 Swift 3 Spelunking

    @gregheo
  2. None
  3. None
  4. Swift 2 Swift 3 Swift 4 ? current proposals

  5. None
  6. None
  7. #selector #keyPath Selector String

  8. @warn_unused_result @noescape

  9. @discardableResult @escaping

  10. #if swift(>=3.1) @available(swift 3.1)

  11. None
  12. None
  13. Any ‣ Classes — easy! ‣ _ObjectiveCBridgeable — easy! ‣

    The rest: auto-box into _SwiftValue
  14. let t: Any.Type = type(of: 1 as Any) print(t is

    Int.Type) // CHECK: true print(t is Float.Type) // CHECK: false (swift/test/Interpreter/generic_casts.swift)
  15. NSNumber Int8 Int16 Int32 Int64 UInt8 UInt16 UInt32 UInt64 Float

    Double NSValue NSRange CGPoint CGVector CGSize CGRect CGAffineTransform CATransform3D CMTime MKCoordinate NSNull _SwiftNull Optionals
  16. [ NSError ] Error ConcreteError domain code userInfo localizedDescription localizedFailureReason

    localizedRecoverySuggestion localizedRecoveryOptions …and more
  17. [ NSError ] CustomNSError LocalizedError RecoverableError domain code userInfo localizedDescription

    localizedFailureReason localizedRecoverySuggestion localizedRecoveryOptions …and more
  18. None
  19. #if os(OSX) #endif

  20. #if os(OSX) || os(iOS) #endif

  21. #if os(OSX) || os(iOS) || os(watchOS) #endif

  22. #if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) #endif ✈

  23. #if !os(Linux) // Apple platform! #else // Linux! #endif

  24. os()
 arch()
 swift() Linux, Windows, FreeBSD, …
 x86_64, arm, arm64,

    …
 by Swift version
  25. #if canImport(UIKit) // UIKit-based code #elseif canImport(Cocoa) // OSX code

    #elseif // Workaround/text, whatever #endif
  26. None
  27. None
  28. ORLY? tell me moar

  29. swiftunboxed.com

  30. apple.github.io/swift-evolution/

  31. None
  32. None
  33. None
  34. Swift 3 Spelunking @gregheo feedback

  35. Swift 3 Spelunking @gregheo feedback