Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Swift6.2時代のconcurrencyを考える会
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
野瀬田 裕樹
September 20, 2025
Technology
1.9k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Swift6.2時代のconcurrencyを考える会
iOSDC 2025 アンカンファレンス資料です
野瀬田 裕樹
September 20, 2025
More Decks by 野瀬田 裕樹
See All by 野瀬田 裕樹
速習iPhone Duo対応
yuukiw00w
1
480
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
210
ネイティブiOSアプリだからできること
yuukiw00w
0
28
野瀬田とSwift愛好会
yuukiw00w
0
33
uhooiさん発ランダムタスクにチャレンジしよう!
yuukiw00w
1
73
ViewModelって200種類あんねん
yuukiw00w
0
50
Validate your App Intents adoption with AppIntentsTesting
yuukiw00w
0
49
App Intentsを実装しよう
yuukiw00w
0
52
iOS26時代の新規アプリ開発
yuukiw00w
0
270
Other Decks in Technology
See All in Technology
OpenTelemetry eBPF Instrumentationの舞台裏 / Behind the Scenes of OpenTelemetry eBPF Instrumentation
ymotongpoo
4
1.3k
積み重なった技術負債への挑戦 〜初手としての全社ゴト化〜
techtekt
PRO
0
1.2k
Spring BootからQuarkusへの移行
tatsuya1bm
2
120
SREは、MCPとAutopilotをこう使え!
kazumax55
2
820
空間オーディオで過去の 自分(ゴースト)と競うランニング 〜HealthKitのルートを足音に変える実装〜
nao_randd
0
220
あるけみー式LTスライド作成術
alchemy1115
1
210
すぐできる衛星通信対応 あとは山奥に行くだけ
tatetate55
0
130
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
3
510
synctest時代のhttptest Go 1.27で変わるHTTPサーバテストの裏側 / go conference2026 synctest and httptest
budougumi0617
1
3k
今話題のAI「Jev」って何? 宇宙最速で学ぶ会
minorun365
PRO
22
14k
おい、エージェントを使って終わらせろ
nwiizo
0
280
LTのテーマ どうきめてる?〜5つの型と私のやり方〜
yama3133
1
110
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
The SEO Collaboration Effect
kristinabergwall1
1
560
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
520
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.9k
Fireside Chat
paigeccino
43
4k
How to Talk to Developers About Accessibility
jct
2
550
The browser strikes back
jonoalderson
0
1.7k
Music & Morning Musume
bryan
48
7.4k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
Transcript
Swift 6.2時代の concurrencyを考える会 @ynoseda
Swift 6.2の新しい機能 • Approachable concurrency • Default Actor Isolation •
@concurrent
Swift 6.2の新しい機能 • Approachable concurrency • Swift 6だと以下の2つを有効にするのと同じ ◦ NonisolatedNonsendingByDefault
◦ InferIsolatedConformances
Swift 6.2の新しい機能 • Approachable concurrency • Swift 5だと以下の5つを有効にするのと同じ ◦ NonisolatedNonsendingByDefault
◦ InferIsolatedConformances ◦ InferSendableFromCaptures ◦ DisableOutwardActorInference ◦ GlobalActorIsolatedTypesUsability
NonisolatedNonsendingByDefault • nonisolatedな非同期関数の挙動が変わる • https://docs.swift.org/compiler/documentation/diagnostics/nonisolated-nonsen ding-by-default/ • NonisolatedNonsendingByDefaultが無効 ◦ nonisolatedな非同期関数はsendingがデフォルト
• NonisolatedNonsendingByDefaultが有効 ◦ nonisolatedな非同期関数はnonsendingがデフォルト ◦ asyncなnonisolated関数を呼んだとき、呼び出し元の actor上で処理が実行される ◦ MainActorから呼び出すとMainActorで実行されるようになる
InferIsolatedConformances • isolated conformanceの概念が導入される • https://github.com/swiftlang/swift-evolution/blob/main/proposals/0470-isolated- conformances.md • nonisolatedなprotocolをactor隔離された状態でのみ適合する感じ •
MainActorのclassにprotocolの準拠を追加しようとしたとき、protocolが nonisolatedを要求していて困っていた事象が解決される ◦ NonisolatedNonsendingByDefault ◦ InferIsolatedConformances
Default Actor Isolation • 何もactorを指定してない状態のときにnonisolatedとMainActorのどちらをデフォル トにするか設定できる • Default Actor IsolationをMainActorにしているとSwift
5系までと近い感覚で実装 できるようになる
@concurrent • DispatchQueue.globalみたいなもの • バックグラウンドで処理したい関数に@concurrentをつけるだけでよくなる
Swift 6.2時代のconcurrency • Default Actor Isolation = MainActor • Approachable
concurrency = true • こうするとどうなるか?
Swift 6.2時代のconcurrency • Default Actor Isolation = MainActor & Approachable
concurrency = true • 非同期処理が必要になるまでは全てがMainActorになる
Swift 6.2時代のconcurrency • Default Actor Isolation = MainActor & Approachable
concurrency = true • 非同期処理が必要になるまでは全てがMainActorになる ◦ static varも許される ◦ Swift 5系と同じ感覚で実装できる
Swift 6.2時代のconcurrency • Default Actor Isolation = MainActor & Approachable
concurrency = true • 非同期処理が必要になるまでは全てがMainActorになる • 非同期処理が必要な場合も基本的に async 関数にするだけでいい • URLSessionなど標準のAPIのasync関数を叩く時もMainActorから叩いていい • 良い感じに必要ならバックグラウンドスレッドで処理してくれる
• Default Actor Isolation = MainActor & Approachable concurrency =
true • 非同期処理が必要になるまでは全てがMainActorになる • 非同期処理が必要な場合も基本的に async 関数にするだけでいい • 重い処理をバックグラウンドで処理したい場合は@concurrentを付けるだけでいい • 同じactorで処理したい要件が出てくるまで(非同期処理に真面目に向き合う必要 が出るまで)はactorをあまり意識しなくていい Swift 6.2時代のconcurrency
Swift 5からSwift 6で苦しんでいる人へ • Default Actor Isolation = MainActor &
Approachable concurrency = true • この設定でかなり修正量が減るのでおすすめ • Xcode 26対応と合わせてSwift 6対応を進めるのが良い感じ
iOSアプリでどこまでactorを意識する? • 同じactorでも同じスレッドで処理するわけじゃない • 同じactorのインスタンスを作ってawait関数を2回叩いたら、違うスレッドで処理され ることもある • nonisolatedな関数を叩いたときにスレッドが変わる?変わらない • そもそもnonisolatedとかnonsendingとか何
• etc
iOSアプリでどこまでactorを意識する? • Swift5系まで意識しなかったはずのあれこれが、Swift 6~6.1では意識させられるよ うになった • Swift 6.2 x Approachable
Concurrency x Default Actor Isolation = MainActorで 「必要になるまでは意識しない」という環境になった
大規模アプリならactorを意識する? • アーキテクチャーとしてマルチパッケージでわけている場合に、全てをDefault Actor Isolation = MainActorにすべき? • 例えばRepositoryか実際のデータアクセスはactorにすべき? •
Entityはnonisolatedの方がいい?
大規模アプリならactorを意識する? • アーキテクチャーとしてマルチパッケージでわけている場合に、全てをDefault Actor Isolation = MainActorにすべき? ◦ できれば全部MainActorの方が考えることは少ないかも ◦
でも明確にactor isolationを意識する必要がある部分をパッケージにわけているなら、 Default Actor Isolationをnonisolatedにしてもいいかも • 例えばRepositoryか実際のデータアクセスはactorにすべき? ◦ 実際のデータアクセスが例えば URLSessionなら勝手にバックグラウンドスレッドで処理してくれる はずなので、MainActorでいい ◦ 画像のdecode処理などで特定の重い処理を隔離したい場合は actorにする • Entityはnonisolatedの方がいい? ◦ MainActor外からも呼び出される可能性がある場合は nonisolatedが良い ◦ 多分App Intentsとかから呼び出されることとかも考慮すると nonisolatedで良いかも