Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Swift Updates - Learn Languages 2025
Search
Yuta Koshizawa
September 06, 2025
Programming
2
660
Swift Updates - Learn Languages 2025
Strict Concurrency Checkingを中心に、前回2021年からのSwiftのアップデートについて説明します。
Yuta Koshizawa
September 06, 2025
Tweet
Share
More Decks by Yuta Koshizawa
See All by Yuta Koshizawa
Swiftのstructとイミュータビリティ
koher
4
740
Swift 6のTyped throwsとSwiftにおけるエラーハンドリングの全体像を学ぶ
koher
4
5.3k
Swift Concurrency時代のiOSアプリの作り方
koher
15
9k
Swift Zoomin' #8
koher
2
650
async/awaitやactorでiOSアプリ開発がどう変わるか Before & Afterの具体例で学ぶ
koher
9
7.4k
Swift Language Updates - Learn Languages 2021
koher
8
1.8k
先取り! Swift 6 の async/await
koher
15
4.1k
SwiftUIで勘違いした話
koher
1
2.9k
iOSエンジニアのための、SwiftからPythonのライブラリを使って機械学習する方法 / Machine Learning using Python from Swift for iOS Engineer
koher
5
15k
Other Decks in Programming
See All in Programming
社内オペレーション改善のためのTypeScript / TSKaigi Hokuriku 2025
dachi023
1
130
「文字列→日付」の落とし穴 〜Ruby Date.parseの意外な挙動〜
sg4k0
0
330
All(?) About Point Sets
hole
0
230
[SF Ruby Conf 2025] Rails X
palkan
0
390
競馬で学ぶ機械学習の基本と実践 / Machine Learning with Horse Racing
shoheimitani
14
14k
宅宅自以為的浪漫:跟 AI 一起為自己辦的研討會寫一個售票系統
eddie
0
260
GeistFabrik and AI-augmented software development
adewale
PRO
0
220
データファイルをAWSのDWHサービスに格納する / 20251115jawsug-tochigi
kasacchiful
2
100
UIデザインに役立つ 2025年の最新CSS / The Latest CSS for UI Design 2025
clockmaker
6
2.8k
TUIライブラリつくってみた / i-just-make-TUI-library
kazto
1
190
2025 컴포즈 마법사
jisungbin
0
160
手軽に積ん読を増やすには?/読みたい本と付き合うには?
o0h
PRO
1
120
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
11
950
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.1k
Speed Design
sergeychernyshev
33
1.3k
Embracing the Ebb and Flow
colly
88
4.9k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.2k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
990
Art, The Web, and Tiny UX
lynnandtonic
303
21k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
Become a Pro
speakerdeck
PRO
30
5.6k
Transcript
Swi$ Yuta Koshizawa @koher
2021 : Swi) 5.5 2025 : Swi) 6.2
Swi$ 5.5ͰSwi$ ConcurrencyΛಋೖ Swi$ Concurrencyͱɺฒߦॲཧؔ࿈ͷػೳ܈
4ؒͰ࠷େͷΞοϓσʔτ Swi% 6ͷϦϦʔεʢ2024ʣ
Ұ൪Өڹ͕େ͖͔ͬͨͷ Strict Concurrency Checking
σʔλڝ߹Λى͜͠ಘΔίʔυ ↓ ⛔ ίϯύΠϧΤϥʔ
ίϯύΠϧ͕௨Δ ↓ ✅ σʔλڝ߹͕ى͜Βͳ͍
Strict Concurrency Checking
Swi$ 6Ͱ Pure Swi)ͰunsafeͳߏจΛΘͳ͚Ε Swi)ͷίʔυσʔλڝ߹Λى͜͞ͳ͍
σʔλڝ߹ͱʁ ෳͷεϨου͔Βಉ͡ϝϞϦྖҬʹಉ࣌ʹΞΫηε͠ɺগͳ͘ ͱͦͷҰ͕ͭॻ͖ࠐΈͰ͋Δͱ͖ʹى͜Δݱ
σʔλڝ߹͕ى͜Δͱ • ະఆٛಈ࡞ • σʔλෆ߹ • Ϋϥογϡ • …
σʔλڝ߹ʹΑΔόάʹରॲͮ͠Β͍ • Λ࠶ݱ͢Δ͜ͱ͕ࠔ • ݪҼ͕σʔλڝ߹Ͱ͋Δͱಥ͖ࢭΊΔͷ͕ࠔ • ίʔυΛमਖ਼ͯ͠ղܾ͞Εͨ͜ͱͷ֬ೝ͕ࠔ
σʔλڝ߹ΛػցతʹࢭͰ͖Δͱ͏Ε͍͠
ݪҼෆ໌ͷΫϥογϡͷ΄ͱΜͲ͕ σʔλڝ߹ʹΑͬͯҾ͖ى͜͞Ε͍ͯͨྫ
ίϯύΠϥ͕ͲͷΑ͏ʹͯ͠ σʔλڝ߹Λ͙ͷ͔
Swi$ίϯύΠϥ ܕΛͬͯσʔλڝ߹Λ͙
Swi$ܕΛݫ֨ʹѻ͏ݴޠ
2014ͷϦϦʔεॳ͔Βnull safetyΛ࣋ͭ let values = [2, 3, 5, 7] print(values.first
+ 1) // ⛔ ίϯύΠϧΤϥʔ
2014ͷϦϦʔεॳ͔Βnull safetyΛ࣋ͭ let values = [2, 3, 5, 7] if
let first = values.first { print(first + 1) // ✅ OK: 3 }
֤ݴޠͰͷ Op$onal / Nullable Type • Kotlin: String? • Python:
str | None • TypeScript: string | null | undefined • ...
Swi$͕ܕΛͬͯ σʔλڝ߹Λ͙ͷSwi$Β͍͠
Ωʔϫʔυ Isola&on Domain ͱ Sendable
Isola&on Domainͱ • Swi%ͷϓϩάϥϜෳͷIsola+on Domainʹׂ͞ΕΔ • ͯ͢ͷॲཧ͍ͣΕ͔ͷIsola+on Domain্Ͱ࣮ߦ͞ΕΔ • ҰͭͷIsola+on
Domain্Ͱɺಉ࣌ʹҰͭͷॲཧ͔࣮͠ߦ͞Ε ͳ͍
⚠ Isola'on DomainεϨουͰͳ͍ ్த·ͰεϨουAͰ࣮ߦ͞Ε ଓ͖͕εϨουBͰ࣮ߦ͞Εͯྑ͍
Isola&on Domainͱ • Swi%ͷϓϩάϥϜʹෳͷIsola+on Domainʹׂ͞ΕΔ • ͯ͢ͷॲཧ͍ͣΕ͔ͷIsola+on Domain্Ͱ࣮ߦ͞ΕΔ • ҰͭͷIsola+on
Domain্Ͱɺಉ࣌ʹҰͭͷॲཧ͔࣮͠ߦ͞Ε ͳ͍
ͲͷΑ͏ͳσʔλ ୯ҰͷIsola&on DomainͰѻ͍ͬͯΔݶΓ σʔλڝ߹ΛҾ͖ى͜͞ͳ͍
ෳͷIsola&on DomainͰ σʔλΛڞ༗͍ͨ͠ͱ͖ʁ
ෳIsola&on DomainͰڞ༗ͯ҆͠શͳܕͱ ҆શͰͳ͍ܕΛ۠ผ͢Δ
ෳIsola&on DomainͰڞ༗ͯ҆͠શͳܕ Sendable
ΠϛϡʔλϒϧΫϥεڞ༗͞Εͯ҆શ final class Foo: Sendable { // Sendable४ڌՄ let value:
Int // ෆม init(value: Int) { self.value = value } } ΠϛϡʔλϒϧΫϥεঢ়ଶ͕มߋ͞Εͳ͍ͷͰɺෳͷ Isola&on DomainؒͰڞ༗ͯ͠σʔλڝ߹ͷݪҼͱͳΒͳ͍
ϛϡʔλϒϧΫϥεڞ༗͞ΕΔͱ҆શͰͳ͍ final class Foo: Sendable { // ίϯύΠϧΤϥʔ var value:
Int // Մม init(value: Int) { self.value = value } } ෳͷIsola&on Domain͔Βಉ࣌ʹΞΫηε͞Εͨͱ͖ʹσʔλڝ ߹ͷݪҼͱͳΓಘΔͷͰ Sendable ४ڌͰ͖ͳ͍
ϩοΫͰอޢ͢ΕϛϡʔλϒϧΫϥεͰ҆શ final class Foo: Sendable { // Sendable४ڌՄ private let
lock: OSAllocatedUnfairLock<Int> var value: Int { get { lock.withLock { $0 } } set { lock.withLock { $0 = newValue } } } init(value: Int) { self.lock = .init(initialState: value) } }
ܕڞ༗͞Εͣίϐʔ͞ΕΔͷͰ҆શ struct Foo: Sendable { // ✅ Sendable४ڌՄ var value:
Int // Մม init(value: Int) { self.value = value } }
ActorݸʑͷIsola*on DomainΛ࣋ͭͷͰ҆શ actor Foo { // ҉తʹSendable४ڌ var value: Int
// Մม init(value: Int) { self.value = value } } ActorݸʑͷΠϯελϯε͕Isola*on DomainΛܗ͠ɺॴଐ͢ Δίʔυ͕ݸʑͷIsola*on Domain্Ͱ࣮ߦ͞ΕΔ
final class Foo { // non-Sendable var value: Int =
42 } actor A { func useFoo(_ foo: Foo) { print(foo.value) // σʔλڝ߹Λى͜͠ಘΔ } } let foo = Foo() let a = A() await a.useFoo(foo) // ⛔ ผͷIsolation Domainʹͤͳ͍ foo.value += 1 // σʔλڝ߹Λى͜͠ಘΔ
struct Foo: Sendable { var value: Int = 42 }
actor A { func useFoo(_ foo: Foo) { print(foo.value) // σʔλڝ߹Λى͜͞ͳ͍ } } let foo = Foo() let a = A() await a.useFoo(foo) // ✅ ผͷIsolation DomainʹͤΔ foo.value += 1 // σʔλڝ߹Λى͜͞ͳ͍
None
ܕͷ Sendable ४ڌΛར༻ͯ͠ ίϯύΠϥ͕σʔλڝ߹Λࢭ
ͦͷଞ
ଟ༷ͳϓϥοτϑΥʔϜͷల։ • Linux • Windows • WebAssembly
ଟ༷ͳ༻్Ͱͷར༻ • αʔόʔαΠυ1 • ϒϥβʢWebAssemblyʣ2 • ΈࠐΈ3 3 ࣄྫ: h%ps:/
/github.com/swi3lang/swi3-playdate-examples 2 ࣄྫ: h%ps:/ /www.youtube.com/watch?v=Q4Tqxe06Pw0 1 ࣄྫ: h%ps:/ /www.swi,.org/blog/swi,-at-apple-migra7ng-the-password-monitoring-service-from-java/
ଟ༷ͳݴޠͱͷ࿈ܞ • C/C++4 • Java5 • JavaScript6 • Python7 7
h$ps:/ /github.com/pvieito/PythonKit 6 h$ps:/ /github.com/swi3wasm/JavaScriptKit 5 h$ps:/ /developer.apple.com/videos/play/wwdc2025/307/ 4 h$ps:/ /www.swi,.org/documenta8on/cxx-interop/
৽͍͠ݴޠػೳ • ϚΫϩ • ॴ༗ݖ • Parameter PacksʢՄมܕύϥϝʔλʣ • InlineArray
ʢݻఆྻʣ • Integer Generic Parameters ʢܕύϥϝʔλʹΛࢦఆʣ • …
·ͱΊ • Swi% 6ͰStrict Concurrency Checking͕ಋೖ • Pure Swi%ͰίϯύΠϥ͕σʔλڝ߹Λશʹࢭ •
ଟ༷ͳϓϥοτϑΥʔϜ༻్ʹల։ • ͦͷଞʹϚΫϩͳͲศརͳ৽ػೳΛՃ
͠Swi$ʹڵຯΛ࣋ͬͨΒ "The Swi) Programming Language"8 ༗ࢤʹΑΔຊޠ൛9͋Γ·͢ 9 h$ps:/ /www.swi,langjp.com/ 8
h$ps:/ /docs.swi/.org/swi/-book/documenta;on/the-swi/-programming-language