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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
野瀬田 裕樹
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
2
850
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
270
ネイティブiOSアプリだからできること
yuukiw00w
0
40
野瀬田とSwift愛好会
yuukiw00w
0
37
uhooiさん発ランダムタスクにチャレンジしよう!
yuukiw00w
1
78
ViewModelって200種類あんねん
yuukiw00w
0
58
Validate your App Intents adoption with AppIntentsTesting
yuukiw00w
0
56
App Intentsを実装しよう
yuukiw00w
0
58
iOS26時代の新規アプリ開発
yuukiw00w
0
280
Other Decks in Technology
See All in Technology
AWS App Runnerから Cloudflare Workersへ移行した話
ryota09
0
110
【ゲームメーカーズスクランブル2026】『Shadowverse: Worlds Beyond』UIとアニメーションで実現する最高のユーザー体験を叶えるプロトタイピング
cygames
PRO
1
670
PQC移行の今 -- IETF からみた現在地
satokan
4
550
2026-09-26 Platform Engineering Kaigi 2026 インフラとアプリの境界線と委譲の設計 / Drawing the Infra and App Line
masasuzu
0
350
IR Today: Theory, Practice, and Agents
dtunkelang
0
160
Snowflake Horizon Catalog と Apache Iceberg で作る オープンなデータ基盤
kitagawaz
0
260
全社共通データ基盤をつくる。ソニーのDatabricks活用とデータガバナンス設計の裏側
sony
0
130
AIエージェントの一手は 誰も見ていない - Falco拡張OSS「Prempti」とeBPFで サーバーレス実行基盤を二層防御する
keitah
1
620
spanner-autoscalerに学ぶ CRD設計パターン 〜自動化と緊急時対応を両立する Kubernetesコントローラーの作り方〜
tkuchiki
0
200
手を動かして実感する、Kiro が変える開発体験
inariku
0
400
Harness Engineering on Rails
joelq
0
690
Azure Serverless 2026:Production-ready な AI エージェント基盤 / Azure Serverless 2026: Production-Ready AI Agent Platform
miyake
2
640
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Ethics towards AI in product and experience design
skipperchong
2
390
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
380
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
510
Agile that works and the tools we love
rasmusluckow
331
22k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
250
Product Roadmaps are Hard
iamctodd
55
13k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.2k
The agentic SEO stack - context over prompts
schlessera
0
940
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
490
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
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で良いかも