Slide 1

Slide 1 text

The Great Swift Migration 1

Slide 2

Slide 2 text

Self Intro 2

Slide 3

Slide 3 text

— Name: Josh Kaplan — Company: GMO Pepabo — App: minne — Strengths: English — Hobbies: Collecting Xcode versions 3

Slide 4

Slide 4 text

30,000 lines of Obj-C 4

Slide 5

Slide 5 text

Why? 5

Slide 6

Slide 6 text

— Future proofing — Safety — Productivity with features like generics, etc — Security 6

Slide 7

Slide 7 text

How? 7

Slide 8

Slide 8 text

Modernize Objective-C 8

Slide 9

Slide 9 text

@property (nonatomic, nonnull) NSArray *creators; @property (nonatomic, nonnull) MICartPayment *payment; @property (nonatomic, nonnull) MIAPIClient *client; @property (nonatomic, nullable) MICoupon *coupon; 9

Slide 10

Slide 10 text

Check nullability in current Swift code let num: Int? = nil "\(num)" // String interpolation produces a debug description for an optional value 10

Slide 11

Slide 11 text

Choosing which areas to migrate — First, modernize models — Then, ViewControllers and ViewModels/Presenters — Work on feature/module basis — Avoid converting code that is then used in obj-c — Cells and smaller views can wait 11

Slide 12

Slide 12 text

Details 12

Slide 13

Slide 13 text

Steps 13

Slide 14

Slide 14 text

1. Move properties in m file to header and add annotations 2. Make Swift file and make extension 3. Migrate non-lifecyle methods and commit for each method 4. Make temporary method for lifecycle and IBAction method contents 5. Migrate lifecycle methods and properties 6. Update storyboard 14

Slide 15

Slide 15 text

Points 15

Slide 16

Slide 16 text

— Only minor refactoring — Writing tests first helps — Communicate with team to prevent conflicts — Things like major renaming should be in separate PRs to make review easier — Set goals and monitor progress with tools like tokei 16

Slide 17

Slide 17 text

Bonus: Migrating to SwiftUI 17

Slide 18

Slide 18 text

— Small components — Use Xcode Preview now — Fewer dependencies — Swift ! 18