ϛϡʔλϒϧΫϥε
let foo: Foo = .init(value: 0)
let foo2 = foo
foo.increment()
print(foo.value) // 1
Slide 41
Slide 41 text
ϛϡʔλϒϧΫϥε
let foo: Foo = .init(value: 0)
let foo2 = foo
foo.increment()
print(foo.value) // 1
print(foo2.value) // 1
Slide 42
Slide 42 text
struct
var foo: Foo = .init(value: 0)
var foo2 = foo
foo.increment()
print(foo.value) // 1
print(foo2.value) // 0
Slide 43
Slide 43 text
ΠϛϡʔλϒϧΫϥε
var foo: Foo = .init(value: 0)
var foo2 = foo
increment(&foo)
print(foo.value) // 1
print(foo2.value) // 0
Slide 44
Slide 44 text
struct ͱΠϛϡʔλϒϧΫϥε
shared mutable stateΛ࣋ͨͳ͍
Slide 45
Slide 45 text
Sendable ४ڌ
final class User: Sendable { //
var name: String
}
final class User: Sendable { //
let name: String
}
struct User: Sendable { //
✅
var name: String
}