Migration to Swift 3: CocoaCoders Austin 2017-03-23
Overview of steps needed to migrate from Objective-C or earlier Swift to Swift 3.
Example of a migration of a small Objective-C project from 2012 to Swift 3.
4 will attempt to not break Swift 3 3. Xcode 8.3+ will not support Swift 2.3 Xcode 8.3 coming soon: ß5 is available 2017-03-21 Xcode 8.3 ß5 is version 8.3 (8E161), no beta in name Cocoa Coders 2017-03-23 Migration to Swift 3 Why
idioms 2. Learn from others’ migrations 3. Decide on migration path 4. Migrate Cocoa Coders 2017-03-23 Migration to Swift 3 Steps For A Successful Migration
hours) Apple Swift 3.0.1: https://developer.apple.com/library/content/ documentation/Swift/Conceptual/Swift_Programming_Language/ (10 hours) Apple Overview: https://developer.apple.com/swift/ (< 1 hour) Cocoa Coders 2017-03-23 Migration to Swift 3 Understand Swift 3 (1 of 2)
idioms 2. Learn from others’ migrations 3. Decide on migration path 4. Migrate Cocoa Coders 2017-03-23 Migration to Swift 3 Steps For A Successful Migration ✔
https://www.reddit.com/r/swift/comments/53ebke/ any_lessons_learned_migrating_to_swift_3_and_how/#bottom-comments Cocoa Coders 2017-03-23 Migration to Swift 3 Learn From Others (1 of 3)
Mobile: https://possiblemobile.com/2016/12/great-swift-3-migration/ Nextdoor: https://engblog.nextdoor.com/migrating-to- swift-3-7add0ce0655#.f5t2awk1w Cocoa Coders 2017-03-23 Migration to Swift 3 Learn From Others (2 of 3)
idioms 2. Learn from others’ migrations 3. Decide on migration path 4. Migrate Cocoa Coders 2017-03-23 Migration to Swift 3 Steps For A Successful Migration ✔ ✔
Migrate from What to What? Objective-C, Swift 1, Swift 2.2, Swift 2.3 2. Freeze code or migrate while enhancing? 3. Migrate to Literal Swift 3 or Idiomatic Swift 3? 4. Simultaneous refactoring and other code improvements? 5. git branching scheme? 6. What does failure look like? Cocoa Coders 2017-03-23 Migration to Swift 3 Decide on Migration Path
idioms 2. Learn from others’ migrations 3. Decide on migration path 4. Migrate Cocoa Coders 2017-03-23 Migration to Swift 3 Steps For A Successful Migration ✔ ✔ ✔
should have opened your code 1. Migrate dependencies (CocoaPods,Carthage, git submodules) 2. Create dependency graph of classes https://github.com/vampirewalk/ObjectGraph-Xcode 3. Migrate starting at leaf classes 4. Monitor .ipa size, compile time Cocoa Coders 2017-03-23 Migration to Swift 3 Migrate (1 of 3)
(possibly via https://objectivec2swift.com/#/home/main) 2. Eliminate translation errors 3. Eliminate other errors 4. Eliminate warnings (let / var) 5. Hook up new Swift code Cocoa Coders 2017-03-23 Migration to Swift 3 Migrate (2 of 3)
idioms 2. Learn from others’ migrations 3. Decide on migration path 4. Migrate Cocoa Coders 2017-03-23 Migration to Swift 3 Steps For A Successful Migration ✔ ✔ ✔ ✔
Migrate from What to What? Objective-C, Swift 1, Swift 2.2, Swift 2.3 2. Freeze code or migrate while enhancing? 3. Migrate to Literal Swift 3 or Idiomatic Swift 3? 4. Simultaneous refactoring and other improvements? 5. git branching scheme? 6. What does failure look like? Cocoa Coders 2017-03-23 Migration to Swift 3 Decide on Migration Path
2. Freeze code 3. Migrate to Literal Swift 3 4. No simultaneous refactoring or other improvements 5. git branching scheme: “Plow Forward Blindly” 6. Failure will be an amusing anecdote Cocoa Coders 2017-03-23 Migration to Swift 3 Decide on Migration Path Example Migration to Swift 3
3. Eliminate other errors 4. Eliminate warnings (let / var) 5. Hook up new Swift code Cocoa Coders 2017-03-23 Migration to Swift 3 Example Migration to Swift 3
3. Eliminate other errors 4. Eliminate warnings (let / var) 5. Hook up new Swift code Cocoa Coders 2017-03-23 Migration to Swift 3 ✔ ✔ ✔ ✔ Example Migration to Swift 3
4 will attempt to not break Swift 3 3. Xcode 8.3+ will not support Swift 2.3 Xcode 8.3 coming soon: ß5 is available 2017-03-21 Xcode 8.3 ß5 is version 8.3 (8E161), no beta in name Cocoa Coders 2017-03-23 Migration to Swift 3 Why