Skip to content

Commit a554d0a

Browse files
committed
wip
1 parent 095002f commit a554d0a

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

Sources/ViewTypes/ToggleWithSwitchStyle.swift

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
11
import SwiftUI
22

3-
// MARK: SwiftUI.Toggle(...).toggleStyle(.switch)
4-
3+
/// An abstract representation of the `Toggle` type in SwiftUI, with `.switch` style.
4+
///
5+
/// ```swift
6+
/// struct ContentView: View {
7+
/// @State var isOn = false
8+
///
9+
/// var body: some View {
10+
/// Toggle("Switch", isOn: $isOn)
11+
/// .toggleStyle(.switch)
12+
/// #if os(iOS)
13+
/// .introspect(.toggle(style: .switch), on: .iOS(.v13, .v14, .v15, .v16, .v17)) {
14+
/// print(type(of: $0)) // UISwitch
15+
/// }
16+
/// #elseif os(macOS)
17+
/// .introspect(.toggle(style: .switch), on: .macOS(.v10_15, .v11, .v12, .v13, .v14)) {
18+
/// print(type(of: $0)) // NSSwitch
19+
/// }
20+
/// #endif
21+
/// }
22+
/// }
23+
/// ```
524
public struct ToggleWithSwitchStyleType: IntrospectableViewType {
625
public enum Style {
726
case `switch`

0 commit comments

Comments
 (0)