Slide 1

Slide 1 text

Swift Language A fast overview of some features @wevtimoteo

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

Objective-c Hello World

Slide 4

Slide 4 text

Swift Hello World

Slide 5

Slide 5 text

Emoji Support

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

Objective-c Extensions

Slide 9

Slide 9 text

Swift Extensions

Slide 10

Slide 10 text

Optionals • Used in situations where value is absent • Alternative for Objective-c nil passing • Works in any type • Can be safely unwrapped (if/else)

Slide 11

Slide 11 text

Lazy variables

Slide 12

Slide 12 text

Functions with Multiple Return Values

Slide 13

Slide 13 text

Immutability

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

Function currying

Slide 16

Slide 16 text

Protocols in Objective-c

Slide 17

Slide 17 text

Protocols in Swift

Slide 18

Slide 18 text

Auto closures

Slide 19

Slide 19 text

Enumerators

Slide 20

Slide 20 text

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