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
1k
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
380
ネイティブiOSアプリだからできること
yuukiw00w
0
52
野瀬田とSwift愛好会
yuukiw00w
0
41
uhooiさん発ランダムタスクにチャレンジしよう!
yuukiw00w
1
87
ViewModelって200種類あんねん
yuukiw00w
0
65
Validate your App Intents adoption with AppIntentsTesting
yuukiw00w
0
62
App Intentsを実装しよう
yuukiw00w
0
63
iOS26時代の新規アプリ開発
yuukiw00w
0
280
Other Decks in Technology
See All in Technology
「社外イベント=意識高い」の壁を壊せ!元々無関心だった僕らが部内で社外イベントを民主化して15人を連れ出すまで
say_no_w
0
130
Kiro Crewで「みのるん式」仕事術やってみた
minorun365
PRO
3
1.1k
フィンテック養成勉強会#68
finengine
0
240
自宅サーバと脆弱性
masakiokuda
1
110
正解のない研修に放り出されて / Being thrown into a training program with no right answers
ohnoeight
1
150
AWS Continuum for Penetration Testing に Deep Dive してみる
asanoharuki
1
1.3k
AI駆動開発におけるハーネスエンジニアリングの勘所
tsukuboshi
1
780
導入から定着へ ~コーディングエージェントを日常業務に組み込む実践知~
yukisakai1225
0
230
Autonomous AI Lakehouse - Live AI Hubから始めるセキュアなAIデータ活用 -
oracle4engineer
PRO
2
150
渡米前の準備を制す!re:Invent 2026徹底準備術 / The Ultimate Preparation Guide for re:Invent 2026
yuj1osm
1
240
[FECONF-2026] 신대륙을 향한 카카오페이증권 프론트엔드 항해기 (이주승)
l1ghthouse
0
200
AWS DevOps Agentはどこまで任せられるか 〜機能の現在地と、機能拡張の実践〜
nyankotaro
0
240
Featured
See All Featured
Making Projects Easy
brettharned
120
6.8k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
370
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
630
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
77k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1.1k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.7k
Raft: Consensus for Rubyists
vanstee
143
7.8k
Embracing the Ebb and Flow
colly
88
5.2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
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で良いかも