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 {
47
47
@State private var first = true
48
48
49
49
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 ( )
57
56
}
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
+ // }
73
74
}
74
75
}
Original file line number Diff line number Diff line change @@ -91,8 +91,8 @@ public struct Transaction {
91
91
}
92
92
93
93
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 ) )
96
96
} else {
97
97
Transaction ( )
98
98
}
Original file line number Diff line number Diff line change @@ -371,7 +371,7 @@ extension GraphHost {
371
371
style: _GraphMutation_Style = . deferred,
372
372
mayDeferUpdate: Bool = true
373
373
) where T: GraphMutation {
374
- preconditionFailure ( " TODO " )
374
+ // preconditionFailure("TODO")
375
375
}
376
376
377
377
package final func asyncTransaction(
Original file line number Diff line number Diff line change 1
1
//
2
- // EnvironmentValuesTest.swift
3
- //
4
- //
5
- // Created by Kyle on 2023/11/21.
6
- //
2
+ // EnvironmentValuesTests.swift
3
+ // OpenSwiftUICompatibilityTests
7
4
8
5
import Testing
9
6
10
- struct EnvironmentValuesTest {
7
+ struct EnvironmentValuesTests {
11
8
struct BoolKey : EnvironmentKey {
12
9
fileprivate static var name : String { " EnvironmentPropertyKey<BoolKey> " }
13
10
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
8
8
struct AppearanceActionModifierTests {
9
9
@Test
10
10
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
- }
17
11
struct ContentView : View {
18
12
var confirmation : Confirmation
19
13
You can’t perform that action at this time.
0 commit comments