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
Androidアプリのモジュール分割における:x:commonを考える
okuzawats
1
280
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
300
非ブラウザランタイムとWeb標準 / Non-Browser Runtimes and Web Standards
petamoriken
0
430
Androidアプリの One Experience リリース
nein37
0
1.2k
Alba: Why, How and What's So Interesting
okuramasafumi
0
210
Lookerは可視化だけじゃない。UIコンポーネントもあるんだ!
ymd65536
1
130
rails newと同時に型を書く
aki19035vc
5
710
ASP.NET Core の OpenAPIサポート
h455h1
0
120
Flatt Security XSS Challenge 解答・解説
flatt_security
0
730
どうして手を動かすよりもチーム内のコードレビューを優先するべきなのか
okashoi
3
870
.NETでOBS Studio操作してみたけど…… / Operating OBS Studio by .NET
skasweb
0
120
PicoRubyと暮らす、シェアハウスハック
ryosk7
0
220
Featured
See All Featured
For a Future-Friendly Web
brad_frost
176
9.5k
Agile that works and the tools we love
rasmusluckow
328
21k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
113
50k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Into the Great Unknown - MozCon
thekraken
34
1.6k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
500
How to train your dragon (web standard)
notwaldorf
89
5.8k
Gamification - CAS2011
davidbonilla
80
5.1k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
360
Documentation Writing (for coders)
carmenintech
67
4.5k
Scaling GitHub
holman
459
140k
Speed Design
sergeychernyshev
25
740
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