File tree Expand file tree Collapse file tree 6 files changed +67
-37
lines changed
Tests/OpenSwiftUICompatibilityTests/SwiftUICore Expand file tree Collapse file tree 6 files changed +67
-37
lines changed Original file line number Diff line number Diff line change @@ -47,28 +47,29 @@ struct ContentView: View {
4747 @State private var first = true
4848
4949 var body : some View {
50- if first {
51- Color . red
52- . onAppear {
53- print ( " Red appear " )
54- DispatchQueue . main. asyncAfter ( deadline: . now( ) + 1 ) {
55- first. toggle ( )
56- }
50+ // if first {
51+ Color ( uiColor: first ? . red : . blue)
52+ . onAppear {
53+ print ( " View appear " )
54+ DispatchQueue . main. asyncAfter ( deadline: . now( ) + 1 ) {
55+ first. toggle ( )
5756 }
58- . onDisappear {
59- print ( " Red disappear " )
60- }
61- } else {
62- Color . blue
63- . onAppear {
64- print ( " Blue appear " )
65- DispatchQueue . main. asyncAfter ( deadline: . now( ) + 1 ) {
66- first. toggle ( )
67- }
68- }
69- . onDisappear {
70- print ( " Blue disappear " )
71- }
72- }
57+ }
58+ // .id(first)
59+ // .onDisappear {
60+ // print("Red disappear")
61+ // }
62+ // } else {
63+ // Color.blue
64+ // .onAppear {
65+ // print("Blue appear")
66+ // DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
67+ // first.toggle()
68+ // }
69+ // }
70+ // .onDisappear {
71+ // print("Blue disappear")
72+ // }
73+ // }
7374 }
7475}
Original file line number Diff line number Diff line change @@ -91,8 +91,8 @@ public struct Transaction {
9191 }
9292
9393 package static var current : Transaction {
94- if let data = _threadTransactionData ( ) as? AnyObject {
95- Transaction ( plist: PropertyList ( data: data) )
94+ if let data = _threadTransactionData ( ) {
95+ Transaction ( plist: PropertyList ( data: data as? AnyObject ) )
9696 } else {
9797 Transaction ( )
9898 }
Original file line number Diff line number Diff line change @@ -371,7 +371,7 @@ extension GraphHost {
371371 style: _GraphMutation_Style = . deferred,
372372 mayDeferUpdate: Bool = true
373373 ) where T: GraphMutation {
374- preconditionFailure ( " TODO " )
374+ // preconditionFailure("TODO")
375375 }
376376
377377 package final func asyncTransaction(
Original file line number Diff line number Diff line change 11//
2- // EnvironmentValuesTest.swift
3- //
4- //
5- // Created by Kyle on 2023/11/21.
6- //
2+ // EnvironmentValuesTests.swift
3+ // OpenSwiftUICompatibilityTests
74
85import Testing
96
10- struct EnvironmentValuesTest {
7+ struct EnvironmentValuesTests {
118 struct BoolKey : EnvironmentKey {
129 fileprivate static var name : String { " EnvironmentPropertyKey<BoolKey> " }
1310
Original file line number Diff line number Diff line change 1+ //
2+ // StateTests.swift
3+ // OpenSwiftUICompatibilityTests
4+
5+ import Testing
6+
7+ #if canImport(Darwin)
8+ struct StateTests {
9+ @Test
10+ func appear( ) async throws {
11+ struct ContentView : View {
12+ var confirmation : Confirmation
13+
14+ @State private var toggle = false
15+
16+ var body : some View {
17+ AnyView ( EmptyView ( ) )
18+ . onAppear {
19+ toggle. toggle ( )
20+ if toggle {
21+ confirmation ( )
22+ }
23+ }
24+ }
25+ }
26+
27+ #if os(iOS)
28+ await confirmation { @MainActor confirmation in
29+ let vc = UIHostingController ( rootView: ContentView ( confirmation: confirmation) )
30+ vc. triggerLayout ( )
31+ workaroundIssue87 ( vc)
32+ }
33+ #endif
34+ }
35+
36+ // TODO: Add disappear support and test case
37+ }
38+ #endif
Original file line number Diff line number Diff line change @@ -8,12 +8,6 @@ import Testing
88struct AppearanceActionModifierTests {
99 @Test
1010 func appear( ) async throws {
11- guard #unavailable( iOS 18 ) else {
12- withKnownIssue {
13- Issue . record ( " Known crash issue on iOS 18 " )
14- }
15- return
16- }
1711 struct ContentView : View {
1812 var confirmation : Confirmation
1913
You can’t perform that action at this time.
0 commit comments