Slide 1

Slide 1 text

About Objects 1818 Library Street | 5th Floor | Reston, VA 20190 main: 571-346-7544 | www.aboutobjects.com Enterprise Consulting • iOS Developer Training Transitioning to Swift

Slide 2

Slide 2 text

About Objects Jonathan Lehr Founder, CEO ! • Developer, author, speaker. • 20+ years Objective-C and Java, including 7 years on iOS. 1818 Library Street | 5th Floor | Reston, VA 20190 main: 571-346-7544 | www.aboutobjects.com iOS Developer Training • Enterprise iOS Development

Slide 3

Slide 3 text

© Copyright 2014, About Objects, Inc. All rights reserved worldwide. About Objects • iOS developer training ‣ Reston, Cupertino, and Boulder • Enterprise development projects (Fortune 500) ‣ iOS and Android ‣ Cloud and Big Data 3

Slide 4

Slide 4 text

© Copyright 2014, About Objects, Inc. All rights reserved worldwide. Problems with C/Obj-C • Usability • Correctness • Predictability • Performance 4

Slide 5

Slide 5 text

© Copyright 2014, About Objects, Inc. All rights reserved worldwide. Suitability • Goal of Apple’s Swift team—design a new language suitable for: ‣ Scripting ‣ Kernel-level programming ‣ Cocoa development (#1 priority) 5

Slide 6

Slide 6 text

© Copyright 2014, About Objects, Inc. All rights reserved worldwide. Playgrounds and REPL • Great environments for learning, experimentation • DEMOs: ‣ Dynamism Playground ‣ Graphics Playground ‣ Balloons Playground (optional) 6

Slide 7

Slide 7 text

© Copyright 2014, About Objects, Inc. All rights reserved worldwide. Current Status • GM release this Fall • ABI not currently stable • Some language features still in flux • Playgrounds have Yosemite dependencies 7

Slide 8

Slide 8 text

Overview of Language Diffs

Slide 9

Slide 9 text

© Copyright 2014, About Objects, Inc. All rights reserved worldwide. Classes and Structures • Value types vs. reference types • Structures can have methods as well as properties • Swift classes don’t respond to NSObject messages unless they’re subclasses of NSObject • Still can leverage dynamic dispatch via @objc and dynamic 9

Slide 10

Slide 10 text

© Copyright 2014, About Objects, Inc. All rights reserved worldwide. Extensions • Similar to Objective-C categories • Extend ‘types’ rather than classes • Can add computed properties as well as methods to structs 10

Slide 11

Slide 11 text

© Copyright 2014, About Objects, Inc. All rights reserved worldwide. Optionals • nil has a different meaning — absence of any value • Optional types may be either nil or have a value • You have to ‘unwrap’ optional values ‣ An Optional is actually a enum with two members, some and none. 11

Slide 12

Slide 12 text

© Copyright 2014, About Objects, Inc. All rights reserved worldwide. Other Features • Enumerations • Pattern matching • Generics 12

Slide 13

Slide 13 text

Adopting Swift

Slide 14

Slide 14 text

© Copyright 2014, About Objects, Inc. All rights reserved worldwide. Background • Concerns and questions that came up regarding some of our current projects • Cerner Millenium+ • NFL Now 14

Slide 15

Slide 15 text

© Copyright 2014, About Objects, Inc. All rights reserved worldwide. Current Status • Language still in beta • Great time to experiment and give feedback to Apple • Not a great time to use for mission-critical projects 15

Slide 16

Slide 16 text

© Copyright 2014, About Objects, Inc. All rights reserved worldwide. Existing ObjC Codebases • Will be with us for a long time • Will need to be enhanced • This includes Apple’s codebases 16

Slide 17

Slide 17 text

© Copyright 2014, About Objects, Inc. All rights reserved worldwide. Cocoa Development • High priority for the compiler engineering team • Some features still missing ‣ For example, some of the UIAppearance API • For the most part though, Swift works quite well 17

Slide 18

Slide 18 text

© Copyright 2014, About Objects, Inc. All rights reserved worldwide. Pitfalls? • Overdoing customization of types and operators • Nobody has “years of experience” in Swift ‣ Many pitfalls and best practices have yet to be determined ‣ We don’t know what we don’t know • Being too eager to adopt quickly, and running into unforeseen problems 18

Slide 19

Slide 19 text

© Copyright 2014, About Objects, Inc. All rights reserved worldwide. Recommendations • Wait for GM release • Ideally, begin with new classes in existing projects ‣ Think, adding a new scene to a storyboard • Consider (with caution) to use as primary language for new projects after GM release ‣ Best to experiment on lower-priority projects 19

Slide 20

Slide 20 text

© Copyright 2014, About Objects, Inc. All rights reserved worldwide. Example App • Storyboard-based iOS app • Includes ‘bridged’ ObjC classes • DEMO: SwiftReadingList-Bridged 20

Slide 21

Slide 21 text

© Copyright 2007–2013, About Objects, Inc. All rights reserved worldwide. For Further Information 21 AO Website http://www.aboutobjects.com AO on LinkedIn http://www.linkedin.com/company/856293 Contact info@aboutobjects.com Apple Swift Resources https://developer.apple.com/swift/blog/

Slide 22

Slide 22 text

© Copyright 2014, About Objects, Inc. All rights reserved worldwide. Questions ? 22