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
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
770
useSyncExternalStoreを使いまくる
ssssota
6
1k
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
250
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
3
470
たのしいparse.y
ydah
3
120
暇に任せてProxmoxコンソール 作ってみました
karugamo
2
720
情報漏洩させないための設計
kubotak
2
170
HTTP compression in PHP and Symfony apps
dunglas
2
1.7k
MCP with Cloudflare Workers
yusukebe
2
220
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
550
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
330
採用事例の少ないSvelteを選んだ理由と それを正解にするためにやっていること
oekazuma
2
1k
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Bash Introduction
62gerente
608
210k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
Writing Fast Ruby
sferik
628
61k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
520
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
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