Migrating from UIKit to SwiftUI efficiently

9f33218af7ae5c04e102fcc3076f2f5c?s=47 yhkaplan
September 20, 2020

Migrating from UIKit to SwiftUI efficiently

9f33218af7ae5c04e102fcc3076f2f5c?s=128

yhkaplan

September 20, 2020
Tweet

Transcript

  1. Migrating from UIKit to Swi!UI efficiently final class MyViewController: UITableViewController

    { private var data = [String]() override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "cell") let d = data[indexPath.row] cell?.textLabel?.text = d return cell ?? UITableViewCell() } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return data.count } } ↓ struct MyView: View { private var data = [String]() var body: some View { List(data, id: \.self) { d in Text(d) } } } 1
  2. Self Intro — Name: Joshua Kaplan — Work: minne @

    GMO Pepabo — Interests: ! CI/CD, " frameworks, and more — Hobbies: # bread, $ history, and running 2
  3. Intro 1. Why move to SwiftUI? 2. Why not move

    to SwiftUI? 3. Modernize Swift Usage 4. Modernize UIKit usage 5. Plan and prototype 6. Two approaches 7. Tips 3
  4. Why move to Swi!UI — Do more with less code

    (for most things) — Easier to implement — The future of GUI development 4
  5. Why not move to Swi!UI — Stability — iOS 12

    and less compatibility — Low-level or high performance needs — Mixing can be difficult and painful without planning — How urgent? 5
  6. Modernize Swi! usage — Migrate from Objective-C! — Use latest

    Swift version — Use Swiftier conventions — Use all the latest features — Get familiar with FRP frameworks 6
  7. Modernize UIKit usage — Use auto layout — Support safe

    area — Components — Thin or no storyboards — Dynamic type and dark mode — Use declarative UIKit APIs 7
  8. Plan and prototype 8

  9. Prototype — Make a prototype — Identify screens/components not suited

    to SwiftUI — Change the design — Make an iOS 13-only feature 9
  10. Architecture — Redux — The Composable Architecture (TCA) — MVVM

    10
  11. Two approaches 11

  12. 12

  13. Tips — Don't mix too much — Start with easier

    screens — Don’t hurry — Study SwiftUI and Combine in advance 13
  14. Conclusion 14

  15. Thank you 15

  16. Reference 16

  17. Prototype — Shop.app 17

  18. Combine 18

  19. Docs — Official Documentation — RxSwift to Combine Cheatsheet —

    CombineϑϨʔϜϫʔΫ·ͱΊ 19
  20. Code — CombineSwiftPlayground — Combine-MVVM — OpenCombine 20

  21. Video — Introducing Combine — Combine in Practice 21

  22. Books — Using Combine — Practical Combine — Understanding Combine

    — Combine: Asynchronous Programming with Swift 22
  23. Swi!UI — Official Documentation 23

  24. Books — Thinking in SwiftUI — SwiftUI by Tutorials 24