Skip to content

Commit f79d393

Browse files
authored
Fix sendable warnings. (#207)
* Fix sendable warnings. * wip * bring back awaits * wip
1 parent 7b139d8 commit f79d393

File tree

3 files changed

+12
-20
lines changed

3 files changed

+12
-20
lines changed

Package.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,3 @@ let package = Package(
5555
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
5656
)
5757
#endif
58-
59-
//for target in package.targets {
60-
// target.swiftSettings = target.swiftSettings ?? []
61-
// target.swiftSettings?.append(
62-
// .unsafeFlags([
63-
// "-Xfrontend", "-warn-concurrency",
64-
// "-Xfrontend", "-enable-actor-data-race-checks",
65-
// "-enable-library-evolution",
66-
// ])
67-
// )
68-
//}

[email protected]

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,14 @@ let package = Package(
109109
)
110110
#endif
111111

112-
//for target in package.targets {
113-
// target.swiftSettings = target.swiftSettings ?? []
112+
for target in package.targets {
113+
target.swiftSettings = target.swiftSettings ?? []
114+
target.swiftSettings?.append(contentsOf: [
115+
.enableExperimentalFeature("StrictConcurrency")
116+
])
114117
// target.swiftSettings?.append(
115118
// .unsafeFlags([
116-
// "-Xfrontend", "-warn-concurrency",
117-
// "-Xfrontend", "-enable-actor-data-race-checks",
118119
// "-enable-library-evolution",
119120
// ])
120121
// )
121-
//}
122+
}

Sources/Dependencies/WithDependencies.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,9 @@ private class DependencyObjects: @unchecked Sendable {
326326
internal init() {}
327327

328328
func store(_ object: AnyObject) {
329-
self.storage.withValue { storage in
330-
storage[ObjectIdentifier(object)] = DependencyObject(
331-
object: object,
329+
self.storage.withValue { [id = ObjectIdentifier(object), object = UncheckedSendable(object)] storage in
330+
storage[id] = DependencyObject(
331+
object: object.wrappedValue,
332332
dependencyValues: DependencyValues._current
333333
)
334334
Task {
@@ -347,7 +347,9 @@ private class DependencyObjects: @unchecked Sendable {
347347
.compactMap({ $1 as? _HasInitialValues })
348348
.first?
349349
.initialValues
350-
?? self.storage.withValue({ $0[ObjectIdentifier(object)]?.dependencyValues })
350+
?? self.storage.withValue({ [id = ObjectIdentifier(object)] in
351+
$0[id]?.dependencyValues
352+
})
351353
}
352354
}
353355

0 commit comments

Comments
 (0)