-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix Transaction.current crash issue * Add StateTests case
- Loading branch information
Showing
6 changed files
with
67 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 3 additions & 6 deletions
9
...a/Environment/EnvironmentValuesTest.swift → .../Environment/EnvironmentValuesTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
Tests/OpenSwiftUICompatibilityTests/SwiftUICore/Data/State/StateTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// StateTests.swift | ||
// OpenSwiftUICompatibilityTests | ||
|
||
import Testing | ||
|
||
#if canImport(Darwin) | ||
struct StateTests { | ||
@Test | ||
func appear() async throws { | ||
struct ContentView: View { | ||
var confirmation: Confirmation | ||
|
||
@State private var toggle = false | ||
|
||
var body: some View { | ||
AnyView(EmptyView()) | ||
.onAppear { | ||
toggle.toggle() | ||
if toggle { | ||
confirmation() | ||
} | ||
} | ||
} | ||
} | ||
|
||
#if os(iOS) | ||
await confirmation { @MainActor confirmation in | ||
let vc = UIHostingController(rootView: ContentView(confirmation: confirmation)) | ||
vc.triggerLayout() | ||
workaroundIssue87(vc) | ||
} | ||
#endif | ||
} | ||
|
||
// TODO: Add disappear support and test case | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters