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
【Ebisu.mobile#3】バイトルアプリへのSwift Concurrency導入とその効果
Search
Cychow
July 05, 2023
Programming
3
340
【Ebisu.mobile#3】バイトルアプリへのSwift Concurrency導入とその効果
Cychow
July 05, 2023
Tweet
Share
More Decks by Cychow
See All by Cychow
【Qiita Night】新卒エンジニアによるSwift6与太予想
eiji127
0
360
Other Decks in Programming
See All in Programming
Macとオーディオ再生 2024/11/02
yusukeito
0
370
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
110
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
230
最新TCAキャッチアップ
0si43
0
140
CSC509 Lecture 13
javiergs
PRO
0
110
距離関数を極める! / SESSIONS 2024
gam0022
0
280
CSC509 Lecture 12
javiergs
PRO
0
160
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
Amazon Qを使ってIaCを触ろう!
maruto
0
410
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
Featured
See All Featured
Teambox: Starting and Learning
jrom
133
8.8k
Six Lessons from altMBA
skipperchong
27
3.5k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Adopting Sorbet at Scale
ufuk
73
9.1k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Scaling GitHub
holman
458
140k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Transcript
όΠτϧΞϓϦͷSwift Concurrency ಋೖͱͦͷޮՌ Eiji Shirakazu, iOS Engineer in dip
ࣗݾհ ന ӥ࢘ / Eiji Shirakazu @cychow_app όΠτϧ iOSΞϓϦ։ൃ୲ ࠷ۙVision
Pro (visionOS)ͷγϛϡϨʔλͰ༡ΜͰ͍·͢ʂ
None
ຊͷ༰ όΠτϧΞϓϦͷ͝հͱ։ൃपΓͷ͓ ͦͦSwift Concurrencyͱ Swift ConcurrencyΛͲͷΑ͏ʹಋೖ͔ͨ͠ Swift Concurrencyಋೖޙͷঢ়گ
όΠτϧΞϓϦͱ… ɾΞϧόΠτ/ύʔτٻਓݕࡧαʔϏε ɾ෯͍͔༷ͭʑͳ݅ͷΞϧόΠτ/ύʔτใɹ ɹΛଟ͘ܝࡌʂ ɾࣸਅಈըͳͲ͔ΒΞϧόΠτ/ύʔτઌͷ੍ಇ͍ͯ ɹ͍Δελοϑɺ৬ͷงғؾͳͲΛ֬ೝ͢Δ͜ͱ͕Ͱ͖Δʂ
ʮॳճΠϯετʔϧޙͷମݧ্ʯػೳʹ͍ͭͯ εϓϥογϡ ٻਓͷҰཡ
ʮॳճΠϯετʔϧޙͷମݧ্ʯػೳʹ͍ͭͯ εϓϥογϡ Ϣʔβʔͷ࣭
ʮॳճΠϯετʔϧޙͷମݧ্ʯػೳͷ։ൃͰ Swift ConcurrencyΛಋೖʂʂ
Swift Concurrencyͱ WWDC21ʹͯొͨ͠৽ͨͳฒߦॲཧͷख๏ async/awaitΩʔϫʔυΛ༻͍Δ͜ͱͰඇಉظॲཧ / ฒߦॲཧΛ࣮ݱ͢Δ async/awaitҎ֎ʹActorTaskɺAsyncStreamͳͲͷ֓೦ొ
None
None
Swift ConcurrencyΛͲͷΑ͏ʹಋೖ͔ͨ͠ ᶃ ·͕ͣࣗੵۃతʹConcurrencyʹ͍ͭͯΠϯϓοτͨ͠ ᶄ ಋೖ͢Δ͜ͱʹͲΕ͘Β͍ͷϝϦοτ͕͋Δ͔Λߟͨ͠
ɾඇಉظॲཧΛಉظॲཧͷΑ͏ʹදه͢Δ͜ͱͰ࣮ߦॱংΛ͍͍͢ Swift ConcurrencyΛಋೖ͢ΔϝϦοτ ɾσʔλڝ߹Λճආ͘͢͠ͳΔ ɾiOS13Ҏ߱Ͱ༻͢Δ͜ͱ͕Ͱ͖Δ ɾΤϥʔϋϯυϦϯάΛߦ͍͘͢ͳΔ ͳͲ…
Swift ConcurrencyΛͲͷΑ͏ʹಋೖ͔ͨ͠ ᶅ ઌഐΤϯδχΞͷํʑͱ૬ஊ͠ɺαʔϏεʹ༩͑ΔӨڹΛߟ্ྀͨ͠Ͱಋೖ ɹ͍ͯ͘͜͠ͱʹͨ͠ ᶃ ·͕ͣࣗੵۃతʹConcurrencyʹ͍ͭͯΠϯϓοτͨ͠ ᶄ ಋೖ͢Δ͜ͱʹͲΕ͘Β͍ͷϝϦοτ͕͋Δ͔Λߟͨ͠ ᶆ
Өڹൣғ͕খ͍͞ʮॳճΠϯετʔϧޙͷମݧʯΛ্ͤ͞ΔϓϩδΣΫτ ɹʹͯಋೖ͢Δ͜ͱͱͨ͠
ɾcompletionHandlerΛ༻͍ͣɺasync/awaitΛ༻͍ͯදه͢Δɻ ɾGCDΛ༻͢ΔՕॴΛTaskʹஔ͖͑Δɻ ɾMainActorΛࢦఆ͢ΔՕॴʹҙ͢Δɻ Swift ConcurrencyΛಋೖ࣌ͷϙΠϯτ ɾwithCheckedContinuationwithCheckedThrowingContinuationͰ ɹطଘͷඇಉظॲཧΛasync/awaitʹରԠͤ͞Δ͜ͱ͕Ͱ͖Δɻ ͳͲ
ͨͩɺ…
໘ͨ͠ ଞͷ։ൃνʔϜϝϯόʔ৽نࢀըऀͷํʹରͯ͠Concurrencyͷ ॻ͖ํͳͲΛͬͯΒ͏ඞཁ͕͋ͬͨɻ
ͷղܾࡦ LTେձࢀՃ
Swift Concurrencyಋೖޙͷঢ়گ ɾιʔείʔυͷՄಡੑ্͕ͨ͠ ɾνʔϜϝϯόʔ͕ੵۃతʹΩϟονΞοϓ͢ΔΑ͏ʹͳͬͨ ʲݱঢ়ʳ ɾαʔυύʔςΟϥΠϒϥϦ͔Βඪ४ϥΠϒϥϦʹҠߦ͢Δ͜ͱ͕Ͱ͖͍ͯΔ
Swift Concurrencyಋೖޙͷঢ়گ ɾSwift6ͷϝδϟʔΞοϓσʔτͷ४උ ʲࠓޙͷ՝ʳ
None
Swift Concurrencyಋೖޙͷঢ়گ ɾࠓޙͷSwift6ͷϝδϟʔΞοϓσʔτͷ४උ ɾίϯύΠϥϑϥάʮStrict Concurrency CheckingʯͷಋೖͳͲݕ౼ ʲࠓޙʳ
ίϯύΠϥϑϥάʮStrict Concurrency Checkingʯ
ίϯύΠϥϑϥάʮExistentialAnyʯಋೖݕ౼த….
Swift Concurrencyಋೖޙͷঢ়گ ɾࠓޙͷSwift6ͷϝδϟʔΞοϓσʔτͷ४උ ɾίϯύΠϥϑϥάʮStrict Concurrency CheckingʯͷಋೖͳͲݕ౼ ɾSendableͷ४ڌͷνΣοΫͳͲ͓͜ͳ͍͖͍ͬͯͨ ʲࠓޙʳ
όΠτϧͰҾ͖ଓ͖ٕज़తઓΛଓ͚͍͖ͯ·͢ʂ
None