Skip to content

Commit 2234d09

Browse files
committed
wip
1 parent b72822e commit 2234d09

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

Sources/ViewTypes/Toggle.swift

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

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

725
#if !os(tvOS)

0 commit comments

Comments
 (0)