ToggleWithSwitchStyleType

@MainActor
public struct ToggleWithSwitchStyleType : IntrospectableViewType

An abstract representation of the Toggle type in SwiftUI, with .switch style.

struct ContentView: View {
    @State var isOn = false

    var body: some View {
        Toggle("Switch", isOn: $isOn)
            .toggleStyle(.switch)
            .introspect(.toggle(style: .switch), on: .iOS(.all)) {
                print(type(of: $0)) // UISwitch
            }
    }
}
  • Undocumented

    See more

    Declaration

    Swift

    public enum Style