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
230
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
280
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
Ruby Parser progress report 2025
yui_knk
1
250
JSONataを使ってみよう Step Functionsが楽しくなる実践テクニック #devio2025
dafujii
0
220
AIを活用し、今後に備えるための技術知識 / Basic Knowledge to Utilize AI
kishida
8
2k
AHC051解法紹介
eijirou
0
640
物語を動かす行動"量" #エンジニアニメ
konifar
14
5.7k
LLMOpsのパフォーマンスを支える技術と現場で実践した改善
po3rin
8
1k
複雑なドメインに挑む.pdf
yukisakai1225
4
820
パッケージ設計の黒魔術/Kyoto.go#63
lufia
3
390
AWS発のAIエディタKiroを使ってみた
iriikeita
1
130
KessokuでDIでもgoroutineを活用する / Go Connect #6
mazrean
0
130
Laravel Boost 超入門
fire_arlo
2
170
Vue・React マルチプロダクト開発を支える Vite
andpad
0
110
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
Building Adaptive Systems
keathley
43
2.7k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
A designer walks into a library…
pauljervisheath
207
24k
[RailsConf 2023] Rails as a piece of cake
palkan
56
5.8k
Rails Girls Zürich Keynote
gr2m
95
14k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Become a Pro
speakerdeck
PRO
29
5.5k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
31
2.2k
Into the Great Unknown - MozCon
thekraken
40
2k
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 開發經驗分享