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
iOS Apple Dev Tutorialsとpointfreeのモダン実装を比較する
Search
ああうえ
July 20, 2023
Programming
1
420
iOS Apple Dev Tutorialsとpointfreeのモダン実装を比較する
ああうえ
July 20, 2023
Tweet
Share
More Decks by ああうえ
See All by ああうえ
エンジニアとデザイナーがわかる iPadの画面サイズ対応入門
kwzr
0
110
react-reconcilerでオレオレReact Nativeを作ろう!
kwzr
1
2.1k
iOS・Androidで使える デザインシステムをどう実装するか
kwzr
3
5.3k
Apple Pencilと左利き対応
kwzr
5
2.1k
BitriseでUIの差分検出
kwzr
0
1.4k
CIをGASで継続的に改善したら幸せになった
kwzr
3
1.6k
Other Decks in Programming
See All in Programming
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
290
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
330
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
170
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
광고 소재 심사 과정에 AI를 도입하여 광고 서비스 생산성 향상시키기
kakao
PRO
0
170
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
Better Code Design in PHP
afilina
PRO
0
120
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
920
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
110
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
38
7.1k
RailsConf 2023
tenderlove
29
900
Fireside Chat
paigeccino
34
3k
Building Applications with DynamoDB
mza
90
6.1k
Designing the Hi-DPI Web
ddemaree
280
34k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
860
A better future with KSS
kneath
238
17k
Code Review Best Practice
trishagee
64
17k
It's Worth the Effort
3n
183
27k
Transcript
͋͋͏͑(@_kwzr_) iOS Apple Dev Tutorialsͱ pointfreeͷϞμϯ࣮Λൺֱ͢Δ
ࣗݾհ • ͋͋͏͑(@_kwzr_) • ॴଐ: ৽نࣄۀ෦ɾCTOࣨσβΠϯγεςϜ෦ • ࣄ: ଟiOSΤϯδχΞ •
झຯ: εϓϥɾ͓ֆ͔͖
iOS։ൃΛֶͿʹ...
AppleͷνϡʔτϦΞϧͬͱ͍ͯʂ
AppleͷνϡʔτϦΞϧΛ ͍ͬͯͩ͘͞
iOS Apple Dev Tutorials • SwiftUIͱUIKitͷνϡʔτϦΞϧ͕͋Δ • εςοϓ͝ͱʹஸೡͳઆ໌ • ϖʔδͷ࠷ޙʹ͕͋Γɺཧղ
ΛνΣοΫͰ͖Δ https://developer.apple.com/tutorials/app-dev-training
Scrumdinger(Standups) • SwiftUI൛Ͱ࣮͞Ε͍ͯΔΞϓϦ • λΠϚʔΛઃఆͰ͖ͨΓɺձٞͷ༰ΛԻ ͨ͠ΓɺࢀՃऀΛهͰ͖ΔΞϓϦ
νϡʔτϦΞϧͰֶͿ͜ͱ • ϨΠΞτ(VStack, HStack...) • ΞΫηγϏϦςΟରԠํ๏ • ϞσϧΛ࡞ͬͯListʹө • ը໘ભҠ(NavigationStack)
• ঢ়ଶཧ(@State, @Binding, ObservableObject, ...) • ϥΠϑαΠΫϧ(onAppear, onDisappear)
νϡʔτϦΞϧͰֶͿ͜ͱ • Swift Concurrency • File ManagerΛͬͨӬଓԽ • গ͠ൃలతͳඳը(PathͳͲ) •
Τϥʔը໘ͷදࣔ • OSͷAPIݺͼग़͠(Speech frameworkݖݶͷڐՄ) • ͳͲ
(͏͜Εࣄ͡ΌΜ)
iOSΞϓϦ։ൃΛֶͼ͍ͨਓʹ ͱ͓ͯ͢͢Ίʂʂ
νϡʔτϦΞϧͬͨɺ͜ͷઌͲ͏͢Ε... • UIKitͱֶ͔ͼ͍ͨ → UIKitνϡʔτϦΞϧɺpixivͷνϡʔτϦΞϧ • ΞʔΩςΫνϟͱ͔ςετͱ͔ • യવͱɺΑΓྑ͍ίʔυΛॻ͖͍ͨͱ͔
pointfreeͷϞμϯ࣮ͱൺΔ
pointfreeco/standups • TCAΛ࡞͍ͬͯΔpointfree͕࡞͍ͬͯΔ • ScrumdingerΛΑΓϞμϯʹॻ͍ͯΈͨϓϩδΣΫτ
Ϟμϯ #ͱ
ϓϩδΣΫτߏΛൺֱ͢Δ
None
None
None
φϏήʔγϣϯपΓͷൺֱ
ϓϩδΣΫτߏΛݟΔ • 2ͭͷϓϩδΣΫτ͕͋ͬͨ • StackBased • TreeBased
None
StackBased vs TreeBased • StackBased • AppViewͰNavigationStack(path:)ΛݟͯɺϧʔςΟϯά • TreeBased •
֤View͔ΒnavigationDestinationΛ֤ͬͯը໘ʹભҠ͍ͯ͠Δ • ͦΕͧΕϝϦσϝ͋Γɺ͜Ε͕શਖ਼ղͱ͍͏ͷݱঢ়ͳ͍
ঢ়ଶϕʔεͷφϏήʔγϣϯʹ͍ͯ͠Δ • pointfreeco/swiftui-navigation • SwiftUIͷը໘ભҠͷΛղܾ͍ͯ͠ΔϥΠϒϥϦ • NavigationLinkTabViewঢ়ଶͱը໘ભҠ͕ඥ͔ͮͳ͍ • ྻڍܕΛͬͯը໘ભҠͰ͖ΔΑ͏ʹ͍ͯ͠Δ •
DeepLinkͳͲΛ͘͢͠ͳΔ
None
None
ςετͷൺֱ
ςετίʔυ͕ॻ͔Ε͍ͯΔ • AppleͷνϡʔτϦΞϧʹςετॻ͔Ε͍ͯͳ͍͕ɺpointfreeͷํ ςετ͕ॻ͔Ε͍ͯΔ • ViewModelతͳͭͷϢχοτςετ • ςετΛॻ͚ΔΑ͏ʹ͍ͯ͠Δ(େࣄ)
ViewͷϩδοΫɾঢ়ଶʹؔ͢Δςετ͕ॻ͚Δ • جຊతʹViewͷϢχοτςετΛॻ͘ͷ͍͠ • ϥΠϒϥϦΛ͏ͳͲ͢ΕͰ͖Δ͕... • https://github.com/nalexn/ViewInspector • Ұൠతͳํ: ViewModelతͳͷΛ࡞ΓɺϩδοΫͱঢ়ଶʹؔ͢Δς
ετΛॻ͘
Apple νϡʔτϦΞϧͰςετΛॻ͍ͯΈΔ • MeetingViewͰΘΕ͍ͯΔScrumTimerΫϥελΠϚʔ + ݱࡏͷൃ දऀͷঢ়ଶΛ࣋ͭModel • ͍ɺViewʹঢ়ଶ͕ͬͨΓॻ͔Ε͍ͯΔײ͡Ͱͳ͔ͬͨͷͰɺλΠ Ϛʔ+ঢ়ଶͷςετΛॻ͚ͨ
None
pointfreeͷtimerͷςετ • DateͷΘΓʹclockΛ͍ɺςετίʔυͰ࣌ؒΛਐΊΒΕΔΑ͏ʹ ͍ͯ͠Δ
None
None
None
Dependency InjectionΛ͍ͯ͠Δ • pointfreeco/swift-dependencies
swift-dependencies͕ͳ͍ͱ͖ • ී௨ʹΔͱςετ༻ͷϞοΫΛࠩ͠ࠐΜͩΓ͢ΔͨΊʹɺί ϯετϥΫλͳͲͰΠϯελϯεΛͨ͠Γ͢Δඞཁ • ໘ɻόέπϦϨʔ͠ͳ͖Ό͍͚ͳ͍࣌ͬͱ໘
ͷఏڙ • SpeechClientͷΠϯελϯεΛఏڙ ͍ͨ͠߹ӈͷΑ͏ʹॻ͘ • ςετ༻ɺϓϨϏϡʔ༻ͷΛఏڙ Մೳ
• @Dependency(\.speechClient)ͰSpeechClientͷΠϯελϯεΛऔͬͯ དྷͯ͘ΕΔΑ͏ʹ • Property WrapperͰ͑ͯศར • ClockUUIDͳͲɺΑ͘͏ͷΛඪ४Ͱఏڙ swift-dependencies͕͋Δͱ͖
ͦͷଞ
SpeechRecognizer • ݩʑͷSpeechRecognizer • Իೝࣝ݁ՌΛड͚औΔ + ݁ՌΛอ࣋͢Δ AppleͷνϡʔτϦΞϧ
pointfree൛ SpeechClient • AsyncThrowingStreamͰྲྀ͚ͩ͢ʹ͍ͯ͠Δ
ࡉ͔͍ॻ͖ํͳͲ • ViewଆͰ͏༻ʹInt, Doubleͷ ϓϩύςΟΛ࡞͍ͬͯΔ • গࠞ͠ཚͦ͠͏ AppleͷνϡʔτϦΞϧ
Durationܕͷ༻ • Durationܕ(iOS 16+)ʹஔ͖Θ͓ͬͯΓɺformatͳͲViewଆͰߦͬͯ ͍Δ pointfreeͷ࣮
• iOS 16͔Β͑Δγϯϓϧͳͷʹ DocumentDirectoryͷऔಘํ๏
Previewͷઆ໌จ • ϓϨϏϡʔͷઆ໌จΛදࣔ͢ΔViewΛࠩ͠ࠐΜͰ͍Δ
None
࿔ΒΕ͍ͯͳ͔ͬͨॴ • SwiftUIͷViewಛʹมߋͯ͠ͳͦ͞͏ • ݩ͔Β͔ͳΓ៉ྷʹ࡞ΒΕ͍ͯΔͱࢥͬͨ
͕࣌ؒͳͯͤ͘ͳ͔ͬͨͱ͜Ζ • Identi fi edArrayͷ • pointfreeతʹਪ͠ϙΠϯτͬΆ͍ • ύϑΥʔϚϯε͕ߴ͍ListΛॻ͖͘͢ •
Ϟνϕʔγϣϯͷจ຺Λ͚ͩ͢Ͱֻ͕͔࣌ؒͬͯ͠·͏ • Sendableॻ͍ͯͨΓ
Ϟμϯͱ • ΑΓྑ͍φϏήʔγϣϯ • DeepLink͘͢͠ • ςελϏϦςΟ • DI •
ͷׂ • ύϑΥʔϚϯε • Identi fi edArray • ΑΓ͘ॻ͚ΔAPI
Apple࣮ͷ؆ܿ͞ྑ͍ • ΞϓϦ։ൃ࢝Ίͨͯͷਓ͕ύϑΥʔϚϯεςελϏϦςΟΛؾʹ͢͠ ͗ͯԿ࣮Ͱ͖ͳ͘ͳΔͷΑ͘ͳ͍
ͳΜͱTCA൛࣮͋Δ
TCAͷExamplesʹStandups͕Ճ͞Εͨ • pointfreeco/swift-composable-architecture • 5݄ʹϦϦʔε͞ΕͨTCAͷNavigationػೳͱڞʹStandupsͷαϯϓϧ Ճ͞Εͨ
pointfreeco/standupsͷඍົ͞Λײ͡Δ TreeBasedͷίʔυ͕ͩɺStackBasedͰࣅͨΑ͏ͳ͜ͱΛ͍ͬͯΔ
pointfreeco/standupsͷඍົ͞Λײ͡Δ TreeBasedͷίʔυ͕ͩɺStackBasedͰࣅͨΑ͏ͳ͜ͱΛ͍ͬͯΔ ↓ͳΜ͔ॻ͖Εͦ͏
• ࢠ(ભҠઌ)ͷΞΫγϣϯReducerͷenumͰཏతʹॻ͚Δ TCA
TCA͍͍ͧ (झࢫ͕ͣΕ͖ͯͦ͏) ͜Ε͚ͩͰͳ͍͚Ͳ...
·ͱΊ • AppleͷνϡʔτϦΞϧ࣮ͱpointfreeͷϞμϯ࣮Λൺֱͨ͠ • ςελϏϦςΟύϑΥʔϚϯεΛҙࣝ͢Δ͜ͱͰϞμϯͳ࣮ʹɻ࣮ ެ։͞Ε͍ͯΔͷͰൺֱͯ͠ΈΑ͏ʂ
AppleͷνϡʔτϦΞϧͬͱ͍ͯʂ ↑ͪͳΈʹ͜ͷਓΤΞϓɻνϡʔτϦΞϧͬͨ͜ͱ͋Γ·ͤΜ
ࢀߟ • https://www.pointfree.co/blog/posts/99-modern-swiftui • pointfreeͷ༗ྉهࣄཧղͷ֬ೝͷΈʹͬͯ·͢