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
340
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
410
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
Temporal Knowledge Graphで作る! 時間変化するナレッジを扱うAI Agentの世界
po3rin
5
1.2k
組織もソフトウェアも難しく考えない、もっとシンプルな考え方で設計する #phpconfuk
o0h
PRO
8
2.8k
퇴근 후 1억이 거래되는 서비스 만들기 | 내가 AI를 사용하는 방법
maryang
2
470
CSC509 Lecture 11
javiergs
PRO
0
290
Tangible Code
chobishiba
2
340
自動テストのアーキテクチャとその理由ー大規模ゲーム開発の場合ー
segadevtech
1
620
GC25 Recap: The Code You Reviewed is Not the Code You Built / #newt_gophercon_tour
mazrean
0
150
フロントエンド開発のためのブラウザ組み込みAI入門
masashi
7
3.7k
Verilator + Rust + gRPC と Efinix の RISC-V でAIアクセラレータをAIで作ってる話 RTLを語る会(18) 2025/11/08
ryuz88
0
290
テーブル定義書の構造化抽出して、生成AIでDWH分析を試してみた / devio2025tokyo
kasacchiful
0
390
CSC305 Lecture 14
javiergs
PRO
0
230
Amazon ECS Managed Instances が リリースされた!キャッチアップしよう!! / Let's catch up Amazon ECS Managed Instances
cocoeyes02
0
130
Featured
See All Featured
A better future with KSS
kneath
239
18k
Become a Pro
speakerdeck
PRO
29
5.6k
GitHub's CSS Performance
jonrohan
1032
470k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Side Projects
sachag
455
43k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.5k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Why Our Code Smells
bkeepers
PRO
340
57k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Testing 201, or: Great Expectations
jmmastey
46
7.7k
Product Roadmaps are Hard
iamctodd
PRO
55
11k
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 開發經驗分享