You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/Introspect.swift
+27Lines changed: 27 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,12 @@
1
1
import SwiftUI
2
2
3
+
/// The scope of introspection i.e. where introspect should look to find
4
+
/// the desired target view relative to the applied `.introspect(...)`
5
+
/// modifier.
3
6
publicstructIntrospectionScope:OptionSet{
7
+
/// Look within the `receiver` of the `.introspect(...)` modifier.
4
8
publicstaticletreceiver=Self(rawValue:1 << 0)
9
+
/// Look for an `ancestor` relative to the `.introspect(...)` modifier.
5
10
publicstaticletancestor=Self(rawValue:1 << 1)
6
11
7
12
@_spi(Private)publicletrawValue:UInt
@@ -12,6 +17,28 @@ public struct IntrospectionScope: OptionSet {
12
17
}
13
18
14
19
extensionView{
20
+
/// Introspects a SwiftUI view to find its underlying UIKit/AppKit instance.
21
+
///
22
+
/// - Parameters:
23
+
/// - viewType: The type of view to be introspected.
24
+
/// - platforms: A list of `PlatformViewVersions` that specify platform-specific entities associated with the view, with one or more corresponding version numbers.
25
+
/// - scope: An optional `IntrospectionScope` that specifies the scope of introspection.
26
+
/// - customize: A closure that hands over the underlying UIKit/AppKit instance ready for customization.
27
+
///
28
+
/// Here's an example usage:
29
+
///
30
+
/// ```swift
31
+
/// struct ContentView: View {
32
+
/// @State var date = Date()
33
+
///
34
+
/// var body: some View {
35
+
/// DatePicker("Pick a date", selection: $date)
36
+
/// .introspect(.datePicker, on: .iOS(.v13, .v14, .v15, .v16, .v17)) {
0 commit comments