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
290
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
350
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
個人開発で徳島大学生60%以上の心を掴んだアプリ、そして手放した話
akidon0000
2
200
より安全で効率的な Go コードへ: Protocol Buffers Opaque API の導入
shwatanap
3
1.1k
2025年版 サーバーレス Web アプリケーションの作り方
hayatow
22
24k
チームのテスト力を鍛える
goyoki
4
1.2k
「社内LT会」を1年続けてみた! / Our Year-Long Journey of Internal Lightning Talks
mackey0225
1
110
Navigating Dependency Injection with Metro
zacsweers
3
5.7k
気づいて!アプリからのSOS 〜App Store Connect APIで始めるパフォーマンス健康診断〜
waka12
0
150
Repenser les filtres API Platform: une nouvelle syntaxe
vinceamstoutz
2
120
LLMとPlaywright/reg-suitを活用した jQueryリファクタリングの実際
kinocoboy2
4
560
2分台で1500examples完走!爆速CIを支える環境構築術 - Kaigi on Rails 2025
falcon8823
2
590
Reactをクライアントで使わない
yusukebe
7
5.5k
スケールする組織の実現に向けた インナーソース育成術 - ISGT2025
teamlab
PRO
3
200
Featured
See All Featured
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.6k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.2k
Docker and Python
trallard
46
3.6k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
2.6k
The Power of CSS Pseudo Elements
geoffreycrofte
78
6k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
3k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.7k
The Straight Up "How To Draw Better" Workshop
denniskardys
237
140k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
31
2.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
30
9.7k
Mobile First: as difficult as doing things right
swwweet
224
9.9k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
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 開發經驗分享