Skip to content

Commit c29a790

Browse files
committed
Adopt strict concurrency
1 parent 89d86e2 commit c29a790

21 files changed

+53
-36
lines changed

Benchmarks/Test.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@
251251
SDKROOT = iphoneos;
252252
SWIFT_COMPILATION_MODE = wholemodule;
253253
SWIFT_OPTIMIZATION_LEVEL = "-O";
254+
SWIFT_STRICT_CONCURRENCY = complete;
254255
SWIFT_VERSION = 5.0;
255256
};
256257
name = Release;
@@ -366,6 +367,7 @@
366367
SDKROOT = iphoneos;
367368
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
368369
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
370+
SWIFT_STRICT_CONCURRENCY = complete;
369371
SWIFT_VERSION = 5.0;
370372
};
371373
name = Debug;

Benchmarks/project.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ settings:
88
CODE_SIGNING_REQUIRED: NO
99
CODE_SIGN_IDENTITY: "-"
1010
CODE_SIGN_STYLE: Manual
11+
SWIFT_STRICT_CONCURRENCY: complete
1112

1213
packages:
1314
swiftui-atom-properties:

Examples/App.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@
324324
PRODUCT_NAME = "$(TARGET_NAME)";
325325
SWIFT_COMPILATION_MODE = wholemodule;
326326
SWIFT_OPTIMIZATION_LEVEL = "-O";
327+
SWIFT_STRICT_CONCURRENCY = complete;
327328
SWIFT_VERSION = 5.0;
328329
TVOS_DEPLOYMENT_TARGET = 16.0;
329330
};
@@ -441,6 +442,7 @@
441442
PRODUCT_NAME = "$(TARGET_NAME)";
442443
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
443444
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
445+
SWIFT_STRICT_CONCURRENCY = complete;
444446
SWIFT_VERSION = 5.0;
445447
TVOS_DEPLOYMENT_TARGET = 16.0;
446448
};

Examples/project.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ settings:
1212
CODE_SIGNING_REQUIRED: NO
1313
CODE_SIGN_IDENTITY: "-"
1414
CODE_SIGN_STYLE: Manual
15+
SWIFT_STRICT_CONCURRENCY: complete
1516

1617
targetTemplates:
1718
App:

Sources/Atoms/Atom/PublisherAtom.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Combine
1+
@preconcurrency import Combine
22

33
/// An atom type that provides a sequence of values of the given `Publisher` as an ``AsyncPhase`` value.
44
///

Sources/Atoms/Context/AtomTestContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Combine
1+
@preconcurrency import Combine
22

33
/// A context structure to read, watch, and otherwise interact with atoms in testing.
44
///

Sources/Atoms/Core/Atom/Atom.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
///
33
/// The value produced by an atom is created only when the atom is watched from somewhere,
44
/// and is immediately released when no longer watched.
5-
public protocol Atom<Produced> {
5+
public protocol Atom<Produced>: Sendable {
66
/// A type representing the stable identity of this atom.
77
associatedtype Key: Hashable
88

Sources/Atoms/Core/Modifier/AtomModifier.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public extension Atom {
99
}
1010

1111
/// A modifier that you apply to an atom, producing a new value modified from the original value.
12-
public protocol AtomModifier {
12+
public protocol AtomModifier: Sendable {
1313
/// A type representing the stable identity of this modifier.
1414
associatedtype Key: Hashable
1515

Sources/Atoms/Core/StoreState.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ internal final class StoreState {
33
var caches = [AtomKey: any AtomCacheProtocol]()
44
var states = [AtomKey: any AtomStateProtocol]()
55
var subscriptions = [AtomKey: [SubscriberKey: Subscription]]()
6+
7+
nonisolated init() {}
68
}

Sources/Atoms/Core/Subscriber.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ internal struct Subscriber {
1111
}
1212

1313
var subscribing: Set<AtomKey> {
14-
get { state?.subscribing ?? [] }
15-
nonmutating set { state?.subscribing = newValue }
14+
get { state?.subscribing.value ?? [] }
15+
nonmutating set { state?.subscribing.value = newValue }
1616
}
1717

1818
var unsubscribe: ((Set<AtomKey>) -> Void)? {
19-
get { state?.unsubscribe }
20-
nonmutating set { state?.unsubscribe = newValue }
19+
get { state?.unsubscribe.value }
20+
nonmutating set { state?.unsubscribe.value = newValue }
2121
}
2222
}

0 commit comments

Comments
 (0)