Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Why SwiftUI? Why TCA?
Search
Ethan Huang
November 03, 2024
Programming
0
350
Why SwiftUI? Why TCA?
2024 年 iPlayground 開場演講題目
Ethan Huang
November 03, 2024
Tweet
Share
More Decks by Ethan Huang
See All by Ethan Huang
個人軟體時代
ethanhuang13
0
420
SwiftUI 導覽狀態探究
ethanhuang13
2
1k
初代 SwiftUI 就用來寫 Watch App 吧!
ethanhuang13
2
1.3k
Install All the Betas ☠️
ethanhuang13
0
180
Other Decks in Programming
See All in Programming
Module Harmony
petamoriken
1
160
自動テストのアーキテクチャとその理由ー大規模ゲーム開発の場合ー
segadevtech
2
960
「10分以内に機能を消せる状態」 の実現のためにやっていること
togishima
1
270
2026年向け会社紹介資料
misu
0
160
知られているようで知られていない JavaScriptの仕様 4選
syumai
0
580
Claude Code on the Web を超える!? Codex Cloud の実践テク5選
sunagaku
0
500
Kotlin + Power-Assert 言語組み込みならではのAssertion Library採用と運用ベストプラクティス by Kazuki Matsuda/Gen-AX
kazukima
0
110
Vueで学ぶデータ構造入門 リンクリストとキューでリアクティビティを捉える / Vue Data Structures: Linked Lists and Queues for Reactivity
konkarin
1
180
Kotlinで実装するCPU/GPU 「協調的」パフォーマンス管理
matuyuhi
0
380
AIの弱点、やっぱりプログラミングは人間が(も)勉強しよう / YAPC AI and Programming
kishida
9
3.9k
What's New in Web AI?
christianliebel
PRO
0
120
Atomics APIを知る / Understanding Atomics API
ssssota
1
130
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
1.8k
BBQ
matthewcrist
89
9.9k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
4 Signs Your Business is Dying
shpigford
186
22k
Agile that works and the tools we love
rasmusluckow
331
21k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Context Engineering - Making Every Token Count
addyosmani
9
380
It's Worth the Effort
3n
187
28k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
Why You Should Never Use an ORM
jnunemaker
PRO
60
9.6k
Transcript
13@iPlayground2024 Why SwiftUI? Why TCA? 13
13@iPlayground2024 About Me 13
13@iPlayground2024 📸 歡迎拍照 本演講結束後暫不提供投影片
13@iPlayground2024 About Me iPlayground 與 13 • 3⃣第三次在 iPlayground 演講
• 🎙weak self podcast https://weakself.dev • 📰13 報(Apple 開發者週報) https://ethanhuang13.com 以上皆源 自 於 iPlayground • 🐦Twitter @ethanhuang13
13@iPlayground2024 ㊙ iOS Developer+ 會員 https://iosdeveloper.plus 13 的獨家 iOS 開發經驗分享
13@iPlayground2024 About Me 為什麼要講這個題 目 • 目 前任職於 UI.com,擔任 iOS
Lead • 團隊有超過 3 年的 SwiftUI + TCA 實務與踩坑經驗
13@iPlayground2024 🚩 今天講 Why,不講 How
13@iPlayground2024 Why SwiftUI? Reason 0
13@iPlayground2024 🤔 為什麼要學 SwiftUI?
13@iPlayground2024 🙅 SwiftUI 無法取代 UIKit 也不需要
13@iPlayground2024 🥰 SwiftUI 還是有好些 Bug 或缺陷 但已經很實 用 了
13@iPlayground2024 👀 Swift Observation iOS 17 以上
13@iPlayground2024 Why SwiftUI? Reason 1
13@iPlayground2024 🤔 為什麼要學 SwiftUI?
13@iPlayground2024 🤪 這樣你就可以罵 SwiftUI 了
13@iPlayground2024
13@iPlayground2024 🤕 iOS 開發者有誰不受傷?
13@iPlayground2024
13@iPlayground2024 🥹 開發者對 SwiftUI 的期待很 高
13@iPlayground2024 Why SwiftUI? Reason 2
13@iPlayground2024 🙋 工 作 用 SwiftUI > UIKit
13@iPlayground2024 🙋 個 人 專案 SwiftUI > UIKit
13@iPlayground2024 👉 你想在下 一 個 iOS 專案 寫 SwiftUI 嗎?
13@iPlayground2024 假設兩個新案 子 或新 工 作 條件完全 一 樣 只差在
UIKit 或 SwiftUI
13@iPlayground2024 Why SwiftUI? Reason 3
13@iPlayground2024 ↔ 你比較熟悉左邊這 一 群, 還是右邊這 一 群?
13@iPlayground2024 •UIKit •Android View •Xamarin •jQuery •SwiftUI •Flutter •React Native
•Jetpack Compose •React •Vue
13@iPlayground2024 ❓ 你看得懂下 面 這三句話嗎?
13@iPlayground2024 1. 每個畫 面 都有 一 個狀態去對應 2. 只要改變狀態,畫 面
就會改變 3. 核 心 邏輯就在於正確改變狀態
13@iPlayground2024 🥲 越熟悉 UIKit,學 SwiftUI 越困難
13@iPlayground2024 🛒學習遷移: 在 一 種情境中所學到的知識或技能 能夠應 用 到另 一 種情境中的過程
正向 / 負向學習遷移
13@iPlayground2024 🥲 越熟悉 UIKit,學 SwiftUI 越困難 (負向學習遷移)
13@iPlayground2024 🤯 我的 SwiftUI 頓悟時刻
13@iPlayground2024
13@iPlayground2024
13@iPlayground2024 •UIKit •Android View •Xamarin •jQuery •SwiftUI •Flutter •React Native
•Jetpack Compose •React •Vue
13@iPlayground2024 🛒 學會 SwiftUI 獲得對現代前端框架的正向遷移
13@iPlayground2024 🥸Bonus: 為什麼 SwiftUI 有很多 Bug?
13@iPlayground2024 1. 每個畫 面 都有 一 個狀態去對應 2. 只要改變狀態,畫 面
就會改變 3. 核 心 邏輯就在於正確改變狀態
13@iPlayground2024 (理想上) 1. 每個畫 面 都有 一 個狀態去對應 2. 只要改變狀態,畫
面 就會改變 3. 核 心 邏輯就在於正確改變狀態
13@iPlayground2024 🤓 理想與現實有巨 大 的差距
13@iPlayground2024 🙂↔ 現實: SwiftUI 與 UIKit 天 生 不相容
13@iPlayground2024 🔧 iOS SwiftUI 的 Bug(fix) 史 或許就是 縮減理想與現實差距的歷史
13@iPlayground2024 Why SwiftUI? Reason 4
13@iPlayground2024 👀 在開發流程中使 用 Preview 的意義是什麼?
13@iPlayground2024 ⚡ 快速得到回饋 修正後再快速得到回饋 修正後再快速得到回饋
13@iPlayground2024 波報 #52
13@iPlayground2024 WWDC23: Design with SwiftUI
13@iPlayground2024 有些東 西 不靠 Preview(這種 方 式) 是創造不出來的
13@iPlayground2024 🔥 不 一 定要 Preview,也可以使 用 Hot Reloading +
Injection
13@iPlayground2024 即使 Preview 常常壞掉... 我還是會要求寫 Preview 的另 一 個原因
13@iPlayground2024 💡 能把 SwiftUI Preview 寫好 View 的狀態設計就不會太差
13@iPlayground2024 🤣老笑話 iOS 開發就是在做 JSON + TableView
13@iPlayground2024
13@iPlayground2024 🚧 為了看清楚每種狀態的 Preview 必須把各種狀態的假資料準備好 準備的過程就是在檢討架構設計
13@iPlayground2024 💡 能把 SwiftUI Preview 寫好 View 的狀態設計就不會太差
13@iPlayground2024 Why SwiftUI? Reason 5
13@iPlayground2024 🙏 Only SwiftUI Can Do
13@iPlayground2024 🎛WidgetKit 家族 Live Activity Dynamic Island Lock Screen Control
⌚Watch App
13@iPlayground2024 🙅 請不要 用 開發 Widget 當作初學 SwiftUI 的題 目
雙重傷害
13@iPlayground2024 Why SwiftUI? Reason 6
13@iPlayground2024 👍 跟 TCA 搭配
13@iPlayground2024 Why TCA? Reason 0
13@iPlayground2024 🙋 有聽過 TCA 嗎?
13@iPlayground2024 The Composable Architecture https://github.com/pointfreeco/ swift-composable-architecture
13@iPlayground2024 Point-Free https://www.pointfree.co/ Brandon Williams Stephen Celis
13@iPlayground2024 1. 每個畫 面 都有 一 個狀態去對應 2. 只要改變狀態,畫 面
就會改變 3. 核 心 邏輯就在於正確改變狀態
13@iPlayground2024 👮 TCA 很擅長管理狀態
13@iPlayground2024 🫨 配套的機制與 Libraries 非常多
13@iPlayground2024 Swift CasePaths Concurrency Extras Custom Dump Swift Dependencies Identified
Collections Swift Navigation Swift Perception Swift Issue Reporting
13@iPlayground2024 還學到了超多 Swift 與 Coding 知識 Swift Package 切模組技巧 Package
manifest 照 compiler 切版本 Swift Concurrency Swift Macros Swift Observation dynamicMememberLookup Algebraic Data Type
13@iPlayground2024 看起來很多 但不要被嚇到
13@iPlayground2024 😰 不對,你應該已經被嚇到了
13@iPlayground2024 🍽 請搜尋「iOS 開發配飯吃」🍚
13@iPlayground2024 🤩 學習應該是快樂的 先輕鬆地看 有興趣再學
13@iPlayground2024 Why TCA? Reason 1
13@iPlayground2024 🙆 有使 用 過 TCA 嗎? 是 1.0 以後的版本嗎?
13@iPlayground2024 🙆 之後的專案 你還會選擇使 用 TCA 嗎?
13@iPlayground2024 🕳 UI Taipei iOS Team 三年以上實際踩坑經驗 上架 2 個中型
App 100% SwiftUI + TCA
13@iPlayground2024 👉 下個專案,依然會選擇 SwiftUI + TCA
13@iPlayground2024 TCA 現在的版本好 用 了嗎? 最新版本 v1.15.2
13@iPlayground2024 1.0 正式版 1.4 Macros 1.7 Observations 1.10 Sharing State
1.13 UIKit Navigation 1.15 Concurrency Ready
13@iPlayground2024 個 人 認為唯 一 明顯缺點 Macros 需要 SwiftSyntax Clean
Build 被拖慢
13@iPlayground2024 😋 已入坑, 小 孩愛吃,會再回購
13@iPlayground2024 Why TCA? Reason 2
13@iPlayground2024 🚦 「TCA 的 T 是 Testable」
13@iPlayground2024 測試重要在哪 怎麼做測試才合理 是個 人 在職涯中 自 己 領悟來的 別
人 無法輕易說服
13@iPlayground2024 至 於我 我很在意邏輯有沒有測試到
13@iPlayground2024 😎 TCA 可以很輕鬆地測試 完整的流程
13@iPlayground2024 Code 好讀 Code Review 很容易抓重點
13@iPlayground2024 TDD
13@iPlayground2024 🚥 寫 TCA 不寫測試就太浪費了
13@iPlayground2024 Why TCA? Reason 3
13@iPlayground2024 👮 狀態的集中管理 (原 生 SwiftUI 不好做)
13@iPlayground2024 🧩 Composable 可組合的
13@iPlayground2024 🎤🎸🎷🎺🎹 團隊分 工 優勢
13@iPlayground2024 Why TCA? Reason 4
13@iPlayground2024 👽 外部依賴的管理
13@iPlayground2024 邏輯的世界是單純的 現實的世界是複雜的
13@iPlayground2024 系統狀況 網路狀況 / Server 狀況 API 回傳值 使 用
者權限 ......
13@iPlayground2024 Swift Dependencies https://github.com/pointfreeco/ swift-dependencies
13@iPlayground2024 Why TCA? Reason 5
13@iPlayground2024 🤖 非常結構化,有利於 AI 輔助 工 具 做 Suggestion /
Completion
13@iPlayground2024 Summary Why SwiftUI? Why TCA?
13@iPlayground2024 Why SwiftUI? 1. 🤪可以罵 SwiftUI 2. 🙋個 人 興趣與社群氛圍
3. 🛒非 UIKit 思考 方 式、前端趨勢 4. 💡Preview 快速回饋的開發哲學 5. 🙏Only SwiftUI Can Do
13@iPlayground2024 Why TCA? 1. 😋已入坑, 小 孩愛吃,會再回購 2. 🚥能輕鬆寫出很關鍵的測試 3.
👮狀態集中管理 + 可組合 4. 👽優秀的外部依賴管理能 力 5. 🤖適合搭配 AI 工 具
13@iPlayground2024 適合團隊 一 起入坑 歡迎來玩
13@iPlayground2024 謝謝聆聽 ㊗ 祝你有個愉快的 iPlayground
13@iPlayground2024 📺 YouTube 搜尋 「iOS 開發配飯吃」
13@iPlayground2024 ㊙ iOS Developer+ 會員 https://iosdeveloper.plus 13 的獨家 iOS 開發經驗分享