Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
370
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
440
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
モデル駆動設計をやってみよう Modeling Forum2025ワークショップ/Let’s Try Model-Driven Design
haru860
0
220
Socio-Technical Evolution: Growing an Architecture and Its Organization for Fast Flow
cer
PRO
0
190
テストやOSS開発に役立つSetup PHP Action
matsuo_atsushi
0
130
AIエージェントでのJava開発がはかどるMCPをAIを使って開発してみた / java mcp for jjug
kishida
4
850
20251127_ぼっちのための懇親会対策会議
kokamoto01_metaps
2
380
乱雑なコードの整理から学ぶ設計の初歩
masuda220
PRO
32
15k
ViewファーストなRailsアプリ開発のたのしさ
sugiwe
0
340
Rediscover the Console - SymfonyCon Amsterdam 2025
chalasr
2
110
WebRTC と Rust と8K 60fps
tnoho
2
1.8k
ID管理機能開発の裏側 高速にSaaS連携を実現したチームのAI活用編
atzzcokek
0
160
ハイパーメディア駆動アプリケーションとIslandアーキテクチャ: htmxによるWebアプリケーション開発と動的UIの局所的適用
nowaki28
0
200
なあ兄弟、 余白の意味を考えてから UI実装してくれ!
ktcryomm
10
10k
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
How to train your dragon (web standard)
notwaldorf
97
6.4k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.5k
Designing for humans not robots
tammielis
254
26k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
A Modern Web Designer's Workflow
chriscoyier
697
190k
Making the Leap to Tech Lead
cromwellryan
135
9.6k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
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 開發經驗分享