-
Notifications
You must be signed in to change notification settings - Fork 366
/
Copy pathDatePickerWithStepperFieldStyle.swift
55 lines (52 loc) · 1.44 KB
/
DatePickerWithStepperFieldStyle.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#if !os(watchOS)
import SwiftUI
/// An abstract representation of the `DatePicker` type in SwiftUI, with `.stepperField` style.
///
/// ### iOS
///
/// Not available.
///
/// ### tvOS
///
/// Not available.
///
/// ### macOS
///
/// ```swift
/// struct ContentView: View {
/// @State var date = Date()
///
/// var body: some View {
/// DatePicker("Pick a date", selection: $date)
/// .datePickerStyle(.stepperField)
/// .introspect(.datePicker(style: .stepperField), on: .macOS(.v10_15, .v11, .v12, .v13, .v14, .v15)) {
/// print(type(of: $0)) // NSDatePicker
/// }
/// }
/// }
/// ```
///
/// ### visionOS
///
/// Not available.
public struct DatePickerWithStepperFieldStyleType: IntrospectableViewType {
public enum Style {
case stepperField
}
}
#if !os(iOS) && !os(tvOS) && !os(visionOS)
extension IntrospectableViewType where Self == DatePickerWithStepperFieldStyleType {
public static func datePicker(style: Self.Style) -> Self { .init() }
}
#if canImport(AppKit) && !targetEnvironment(macCatalyst)
extension macOSViewVersion<DatePickerWithStepperFieldStyleType, NSDatePicker> {
public static let v10_15 = Self(for: .v10_15)
public static let v11 = Self(for: .v11)
public static let v12 = Self(for: .v12)
public static let v13 = Self(for: .v13)
public static let v14 = Self(for: .v14)
public static let v15 = Self(for: .v15)
}
#endif
#endif
#endif