From a presentation at a CocoaHeads DC meeting, September 4, 2014. Provides a brief overview of potential benefits, hurdles, and pitfalls for Objective-C development teams to consider as they contemplate adopting the Swift programming languages.
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
About Objects • iOS developer training ‣ Reston, Cupertino, and Boulder • Enterprise development projects (Fortune 500) ‣ iOS and Android ‣ Cloud and Big Data 3
Suitability • Goal of Apple’s Swift team—design a new language suitable for: ‣ Scripting ‣ Kernel-level programming ‣ Cocoa development (#1 priority) 5
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
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
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
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
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
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
For Further Information 21 AO Website http://www.aboutobjects.com AO on LinkedIn http://www.linkedin.com/company/856293 Contact [email protected] Apple Swift Resources https://developer.apple.com/swift/blog/