Slide 1

Slide 1 text

S W I F T, W H Y I W O N ’ T G O B A C K T O O B J E C T I V E - C R O B E R T VA N L O G H E M - S W I F T G U Y @ S U I T S U P P LY T: @ S O U N D B I T E S E : R VA N L O G H E M @ S U I T S U P P LY. C O M

Slide 2

Slide 2 text

A B O U T M E • Lots of backend in Java (’99) and some Scala • Actionscript/Javascript • Doing iOS since 2010 for NS, ProRail some small clients and now Suitsupply • Love road-cycling 100+km’s and tinkering with Bluetooth LE heart rate, power, cadence, speed, external displays

Slide 3

Slide 3 text

M Y R U L E S • Let the compiler catch my mistakes • Concise • Immutability • It’s ok to be a little verbose • Good code does not need documentation • Refactor, refactor, refactor, … • Composition • Clear responsibilities • Embrace change

Slide 4

Slide 4 text

M Y T O O L S • PaintCode • AppCode* • Crashlytics • parse.com • Cocoapods • Cocoacontrols • Dash • Sketch

Slide 5

Slide 5 text

A B O U T S U I T S U P P LY • Doing instore sales apps on iPod Touches • Working on customer apps • Working on secret projects • need good people…who can’t go back to 
 Objective-C

Slide 6

Slide 6 text

< 1 . 2 ~ > 1 . 2

Slide 7

Slide 7 text

“I started with Swift < 1.0 because I did some Scala in the past and it seemed to be the new Apple future”

Slide 8

Slide 8 text

M A R M O T T E C R E A T E A C Y C L I N G A P P, T H A T U S E S S W I F T A N D B L U E T O O T H L E C O N N E C T I V I T Y 11:11 01:43 41 65 31.2 39.3 3 164 89

Slide 9

Slide 9 text

L O V E • let vs var • Options: SomeClass?, .None, .Some(x) • if let x = y as? SomeClass • No more headers! • switch, case, where • Type inference • map, filter, reduce chaining • closures where you can remember the syntax • Less verbose • Named tuples • Generics

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

H AT E • Weird compiler error messages • Slow compilation • Crashes… • if let { if let { if let }} nesting hell • Slow arrays and dictionaries • Symbolicated Swift crash logs

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

“Then Apple started on improving Swift and tuning its syntax”

Slide 14

Slide 14 text

“In december 2014 ~20% of the code in the NS Reisplanner Xtra consisted of Swift code”

Slide 15

Slide 15 text

B E T W E E N < 1 . 0 A N D 1 . 2 • Cumbersome but helpful syntax upgrades • private/public/internal access for properties • But after creating more Swift files the compiler slowed to a crawl… • Fail-able initialisers

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

B U T W H AT A B O U T M Y T O O L S ? • AppCode is WAAAAY behind, so proper refactoring is a pain… • PaintCode catched up pretty quickly • So did Dash…

Slide 18

Slide 18 text

“Swift 1.2 launched and IMHO can be used in production”

Slide 19

Slide 19 text

“Now in since march 2015 I’ve gone 100% Swift”

Slide 20

Slide 20 text

M O R E L O V E • The compiler became fast (incremental) • if let a = b, c = d where a == • Nullability safety • Set • Default values

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

“So what was the most profound improvement since moving to Swift?”

Slide 23

Slide 23 text

“In the TestFlight Beta all my crashes are occurring in other frameworks”

Slide 24

Slide 24 text

R U L E S I A P P LY T O S W I F T D E V E L O P M E N T • Never ever use ! with optionals unless you REALLY know what you are doing it’s the main source of my crashes • Use if let all over the place • Use generics and embrace type inference and Swift’s type system in general • Let the compiler really help you…

Slide 25

Slide 25 text

S O W H AT ’ S N E X T ? • FutureKit • NotificationObserverKit • Reactive Cocoa 3.0


Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

“My goal is to: make everything type safe…and be crystal clear about my intentions”

Slide 29

Slide 29 text

S W I F T , W H Y I W O N ’ T G O B A C K T O O B J E C T I V E - C T: @ S O U N D B I T E S E : R VA N L O G H E M @ S U I T S U P P LY. C O M