File tree 2 files changed +4
-5
lines changed
2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ public struct Defaults {
47
47
48
48
/// Shared instance of `Defaults`, used for ad-hoc access to the user's
49
49
/// defaults database throughout the app.
50
- public nonisolated ( unsafe ) static let shared = Defaults ( )
50
+ public static let shared = Defaults ( )
51
51
52
52
/// An instance of `Defaults` with the specified `UserDefaults` instance.
53
53
///
Original file line number Diff line number Diff line change @@ -215,9 +215,9 @@ struct DefaultsKitTests {
215
215
}
216
216
217
217
@Test
218
- func testThreadSafe ( ) async throws {
218
+ func testThreadUnsafe ( ) async {
219
219
// Given
220
- let defaults = Defaults . shared
220
+ let defaults = Defaults ( )
221
221
let iterations = 10000
222
222
223
223
// When
@@ -226,7 +226,6 @@ struct DefaultsKitTests {
226
226
227
227
await withTaskGroup ( of: Void . self) { taskGroup in
228
228
for i in 1 ... iterations {
229
- // Add a task to the group
230
229
taskGroup. addTask {
231
230
defaults. set ( i, for: . integerKey) // Write a value
232
231
if let value = defaults. get ( for: . integerKey) {
@@ -242,6 +241,6 @@ struct DefaultsKitTests {
242
241
}
243
242
244
243
// Then
245
- #expect( expected = = actual)
244
+ #expect( expected ! = actual)
246
245
}
247
246
}
You can’t perform that action at this time.
0 commit comments