We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 13b3481 commit 5d174b9Copy full SHA for 5d174b9
Sources/AppState/Application/Types/State/Application+State.swift
@@ -34,14 +34,27 @@ extension Application {
34
)
35
else {
36
defer {
37
- shared.cache.set(
38
- value: Application.State(
39
- type: .state,
40
- initial: _value,
41
- scope: scope
42
- ),
43
- forKey: scope.key
44
- )
+ let setValue = {
+ shared.cache.set(
+ value: Application.State(
+ type: .state,
+ initial: _value,
+ scope: scope
+ ),
+ forKey: scope.key
45
+ )
46
+ }
47
+ #if (!os(Linux) && !os(Windows))
48
+ if NSClassFromString("XCTest") == nil {
49
+ Task { @MainActor in
50
+ setValue()
51
52
+ } else {
53
54
55
+ #else
56
57
+ #endif
58
}
59
return _value
60
0 commit comments