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

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

    View Slide

  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

    View Slide

  3. Objective-c Hello World

    View Slide

  4. Swift Hello World

    View Slide

  5. Emoji Support

    View Slide

  6. Swift Features
    • Optional types
    • Named/default parameters
    • Namespacing
    • Functions are first class citizens

    View Slide

  7. Objective-c Bridging
    • NSArray == Array
    • NSDictionary == Dictionary
    • NSNumber == Int, Double, Float

    View Slide

  8. Objective-c Extensions

    View Slide

  9. Swift Extensions

    View Slide

  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)

    View Slide

  11. Lazy variables

    View Slide

  12. Functions with Multiple
    Return Values

    View Slide

  13. Immutability

    View Slide

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

    View Slide

  15. Function currying

    View Slide

  16. Protocols in Objective-c

    View Slide

  17. Protocols in Swift

    View Slide

  18. Auto closures

    View Slide

  19. Enumerators

    View Slide

  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

    View Slide