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
410
iOS Apple Dev Tutorialsとpointfreeのモダン実装を比較する
ああうえ
July 20, 2023
Tweet
Share
More Decks by ああうえ
See All by ああうえ
エンジニアとデザイナーがわかる iPadの画面サイズ対応入門
kwzr
0
100
react-reconcilerでオレオレReact Nativeを作ろう!
kwzr
1
2.1k
iOS・Androidで使える デザインシステムをどう実装するか
kwzr
3
5.2k
Apple Pencilと左利き対応
kwzr
5
2k
BitriseでUIの差分検出
kwzr
0
1.4k
CIをGASで継続的に改善したら幸せになった
kwzr
3
1.6k
Other Decks in Programming
See All in Programming
CPython 인터프리터 구조 파헤치기 - PyCon Korea 24
kennethanceyer
0
240
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
130
Tuning GraphQL on Rails
pyama86
2
1k
レガシーな Android アプリのリアーキテクチャ戦略
oidy
1
170
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
3
390
Universal Linksの実装方法と陥りがちな罠
kaitokudou
1
220
Vitest Browser Mode への期待 / Vitest Browser Mode
odanado
PRO
2
1.7k
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
23k
JaSST 24 九州:ワークショップ(は除く)実践!マインドマップを活用したソフトウェアテスト+活用事例
satohiroyuki
0
260
gopls を改造したら開発生産性が高まった
satorunooshie
8
240
Importmapを使ったJavaScriptの 読み込みとブラウザアドオンの影響
swamp09
4
1.2k
推し活の ハイトラフィックに立ち向かう Railsとアーキテクチャ - Kaigi on Rails 2024
falcon8823
6
2.1k
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
790
RailsConf 2023
tenderlove
29
880
ReactJS: Keep Simple. Everything can be a component!
pedronauck
664
120k
YesSQL, Process and Tooling at Scale
rocio
167
14k
Fashionably flexible responsive web design (full day workshop)
malarkey
404
65k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
KATA
mclloyd
29
13k
Done Done
chrislema
181
16k
StorybookのUI Testing Handbookを読んだ
zakiyama
26
5.2k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
Why You Should Never Use an ORM
jnunemaker
PRO
53
9k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
231
17k
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ͷ༗ྉهࣄཧղͷ֬ೝͷΈʹͬͯ·͢