File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ public struct Defaults {
4747
4848 /// Shared instance of `Defaults`, used for ad-hoc access to the user's
4949 /// defaults database throughout the app.
50- public nonisolated ( unsafe ) static let shared = Defaults ( )
50+ public static let shared = Defaults ( )
5151
5252 /// An instance of `Defaults` with the specified `UserDefaults` instance.
5353 ///
Original file line number Diff line number Diff line change @@ -215,9 +215,9 @@ struct DefaultsKitTests {
215215 }
216216
217217 @Test
218- func testThreadSafe ( ) async throws {
218+ func testThreadUnsafe ( ) async {
219219 // Given
220- let defaults = Defaults . shared
220+ let defaults = Defaults ( )
221221 let iterations = 10000
222222
223223 // When
@@ -226,7 +226,6 @@ struct DefaultsKitTests {
226226
227227 await withTaskGroup ( of: Void . self) { taskGroup in
228228 for i in 1 ... iterations {
229- // Add a task to the group
230229 taskGroup. addTask {
231230 defaults. set ( i, for: . integerKey) // Write a value
232231 if let value = defaults. get ( for: . integerKey) {
@@ -242,6 +241,6 @@ struct DefaultsKitTests {
242241 }
243242
244243 // Then
245- #expect( expected = = actual)
244+ #expect( expected ! = actual)
246245 }
247246}
You can’t perform that action at this time.
0 commit comments