Slide 1

Slide 1 text

Production Swift Ash Furrow

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Objective-C

Slide 4

Slide 4 text

Agenda 1. Swift is Awesome 2. Tools are Immature 3. Be Informed

Slide 5

Slide 5 text

Swift is Different

Slide 6

Slide 6 text

How is it different? • Static vs. Dynamic • Prefers immutability • Encourages functional programming • Safe (well, safer) • Experimentation via Playgrounds

Slide 7

Slide 7 text

Optional Protocol Methods @protocol MyProtocol @required - (void)doSomethingNecessary; @optional - (void)doSomethingOptional; @end

Slide 8

Slide 8 text

Optional Protocol Methods protocol MyProtocol { func doSomethingNecessary() optional func doSomethingOptional() } // Compiler Error!

Slide 9

Slide 9 text

Optional Protocol Methods func doSomethingNecessary() optional func doSomethingOptional() } @objc protocol MyProtocol {

Slide 10

Slide 10 text

Objective-C Interoperability • Interoperability comes at the cost of Swift’s purity • We loose a lot of safety • Don’t just add @objc because it’ll make code compile

Slide 11

Slide 11 text

Swift is Better

Slide 12

Slide 12 text

Objective-C Hurts Me if (indexPath.section == 0) { if (indexPath.row == 0) { } else if (indexPath.row == 1) { 
 } else if ... } else if (indexPath.section == 1) { if (indexPath.row == 0) { } else if (indexPath.row == 1) { 
 } else if ... } else if ...

Slide 13

Slide 13 text

Pattern Matching switch (indexPath.section, indexPath.row) { case (0, 0): case (0, 1): case (1, 0): case (1, 1): default: // nop }

Slide 14

Slide 14 text

Pattern Matching case (let section, 0) where section % 2 == 0: case (0, let row): case let (0, row) where validate(row):

Slide 15

Slide 15 text

Self-Evaluating Lazy Closures class MySweetViewController: UIViewController { lazy var button: UIButton = { let button = UIButton.buttonWithType(.System) // configure button return button }() }

Slide 16

Slide 16 text

And many more … enums closures tuples generics compile-time awesomeness saved a kitten from a fire went to highschool prom with me function currying functions are closures array.sort(<) better terroir immutability by default type inference discovered penicillin operator overloading clear mutability syntax native collections REPL multiple return types concise pattern-matching

Slide 17

Slide 17 text

Tools are Immature

Slide 18

Slide 18 text

Apple Tools • Xcode, clang, Playgrounds, SourceKit, code signing, frameworks … • All are unstable • Causes frustrations • Causes delays • Causes hair loss

Slide 19

Slide 19 text

github.com/artsy/eidolon

Slide 20

Slide 20 text

Open Source by Default

Slide 21

Slide 21 text

Using Swift doubled our development time

Slide 22

Slide 22 text

“We don’t expect to make our deadline.”

Slide 23

Slide 23 text

Eidolon Problems • Enterprise code signing issues with Xcode 6.1 • Compiler segfaults with optimizations enabled • Constant Xcode/SourceKit crashes • Unit testing problems

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

Burnout

Slide 26

Slide 26 text

We made our deadline

Slide 27

Slide 27 text

Eidolon Awesomeness • We helped pioneer a new way of writing iOS software • Created many new libraries, tools, and resources • Used others’ new tools and contributed bug reports and fixes • Learnt a tonne, shared with others

Slide 28

Slide 28 text

Apple Tools • Someday soon, these will be ready for everyday use • But not today • You will have unanticipated problems • There will be no known solutions or workarounds • Until then, use with caution

Slide 29

Slide 29 text

3rd Party Tools • CocoaPods 0.36 has support for Swift • Tremendous amount of open source effort • Pre-1.0, use with caution • Carthage is new but promising • Pre-1.0, use with caution

Slide 30

Slide 30 text

Be Informed

Slide 31

Slide 31 text

Making a Choice • What’s your aversion to risks? • How hard is your deadline? • Why are you building something? • How open is your team to learning a new language?

Slide 32

Slide 32 text

Why Bother?

Slide 33

Slide 33 text

Swifxpert Become a

Slide 34

Slide 34 text

Blog

Slide 35

Slide 35 text

Risks Rewards vs.

Slide 36

Slide 36 text

Be Aware • Don’t be afraid to revisit your decision • It’s OK to switch back to Objective-C

Slide 37

Slide 37 text

Recap Swift is Awesome Tools are Immature Be Informed

Slide 38

Slide 38 text

Make an informed choice. So start now. You need to know Swift to be informed.