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

Swift language - A fast overview of some features

Swift language - A fast overview of some features

Short slide about Swift programming language and its features.

Learn about: variables, hello world, optionals, enumerators, emojis, differences between Objective-c.

Weverton do Couto Timoteo

October 16, 2014
Tweet

More Decks by Weverton do Couto Timoteo

Other Decks in Programming

Transcript

  1. Swift Language A fast overview of some features @wevtimoteo

  2. Technical Features • Cocoa and CocoaTouch • Build in LLVM

    compiler • ARC (Automatic Reference Counting) memory management • Same runtime as Objective-C (Bridged) • No pointers • Static, inferred typing
  3. Objective-c Hello World

  4. Swift Hello World

  5. Emoji Support

  6. Swift Features • Optional types • Named/default parameters • Namespacing

    • Functions are first class citizens
  7. Objective-c Bridging • NSArray == Array • NSDictionary == Dictionary

    • NSNumber == Int, Double, Float
  8. Objective-c Extensions

  9. Swift Extensions

  10. Optionals • Used in situations where value is absent •

    Alternative for Objective-c nil passing • Works in any type • Can be safely unwrapped (if/else)
  11. Lazy variables

  12. Functions with Multiple Return Values

  13. Immutability

  14. Array Imutability It's a bug: https://devforums.apple.com/messages/971330#971330

  15. Function currying

  16. Protocols in Objective-c

  17. Protocols in Swift

  18. Auto closures

  19. Enumerators

  20. References • https://developer.apple.com/swift/ • http://swiftlang.eu/ • https://devforums.apple.com/community/tools/ languages/swift • https://speakerdeck.com/lebedev/swift

    • https://speakerdeck.com/dictav/swiftwoshao- sidake