Post on 08-Aug-2015
Swift LanguageA fast overview of some features
@wevtimoteo
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
Objective-c Hello World
Swift Hello World
Emoji Support
Swift Features
• Optional types
• Named/default parameters
• Namespacing
• Functions are first class citizens
Objective-c Bridging
• NSArray == Array
• NSDictionary == Dictionary
• NSNumber == Int, Double, Float
Objective-c Extensions
Swift Extensions
Optionals• Used in situations where value is absent
• Alternative for Objective-c nil passing
• Works in any type
• Can be safely unwrapped (if/else)
Lazy variables
Functions with Multiple Return Values
Immutability
Array Imutability
It's a bug: https://devforums.apple.com/messages/971330#971330
Function currying
Protocols in Objective-c
Protocols in Swift
Auto closures
Enumerators
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