@@ -45,7 +45,17 @@ extension View {
45
45
scope: IntrospectionScope ? = nil ,
46
46
customize: @escaping ( PlatformSpecificEntity ) -> Void
47
47
) -> some View {
48
- self . modifier ( IntrospectModifier ( viewType, platforms: platforms, scope: scope, customize: customize) )
48
+ self . modifier ( IntrospectModifier ( viewType, on: platforms, scope: scope, customize: customize) )
49
+ }
50
+
51
+ @_spi ( Advanced)
52
+ public func introspect< SwiftUIViewType: IntrospectableViewType , PlatformSpecificEntity: PlatformEntity > (
53
+ _ viewType: SwiftUIViewType ,
54
+ onOrAfter platforms: ( PlatformViewVersionSingle < SwiftUIViewType , PlatformSpecificEntity > ) ... ,
55
+ scope: IntrospectionScope ? = nil ,
56
+ customize: @escaping ( PlatformSpecificEntity ) -> Void
57
+ ) -> some View {
58
+ self . modifier ( IntrospectModifier ( viewType, onOrAfter: platforms, scope: scope, customize: customize) )
49
59
}
50
60
}
51
61
@@ -57,7 +67,7 @@ struct IntrospectModifier<SwiftUIViewType: IntrospectableViewType, PlatformSpeci
57
67
58
68
init (
59
69
_ viewType: SwiftUIViewType ,
60
- platforms: [ PlatformViewVersionGroup < SwiftUIViewType , PlatformSpecificEntity > ] ,
70
+ on platforms: [ PlatformViewVersionGroup < SwiftUIViewType , PlatformSpecificEntity > ] ,
61
71
scope: IntrospectionScope ? ,
62
72
customize: @escaping ( PlatformSpecificEntity ) -> Void
63
73
) {
@@ -70,6 +80,21 @@ struct IntrospectModifier<SwiftUIViewType: IntrospectableViewType, PlatformSpeci
70
80
self . customize = customize
71
81
}
72
82
83
+ init (
84
+ _ viewType: SwiftUIViewType ,
85
+ onOrAfter platforms: [ PlatformViewVersionSingle < SwiftUIViewType , PlatformSpecificEntity > ] ,
86
+ scope: IntrospectionScope ? ,
87
+ customize: @escaping ( PlatformSpecificEntity ) -> Void
88
+ ) {
89
+ self . scope = scope ?? viewType. scope
90
+ if let platform = platforms. first ( where: \. isCurrentOrPast) {
91
+ self . selector = platform. selector ?? . default
92
+ } else {
93
+ self . selector = nil
94
+ }
95
+ self . customize = customize
96
+ }
97
+
73
98
func body( content: Content ) -> some View {
74
99
if let selector {
75
100
content
0 commit comments