Link Search Menu Expand Document

Switch

A control that offers a binary choice, such as on/off.

public class Switch: Control 

Inheritance

Control

Initializers

init(frame:)

Returns an initialized switch object.

public init(frame: Rect) 

Properties

isOn

A Boolean value that determines the off/on state of the switch.

public var isOn: Bool 

preferredStyle

The preferred display style for the switch.

public var preferredStyle: Switch.Style = .automatic 

style

The display style for the switch.

public private(set) var style: Switch.Style = .checkbox

title

The title displayed next to a checkbox-style switch.

@_Win32WindowText
  public var title: String?

Methods

setOn(_:animated:)

Set the state of the switch to On or Off, optionally animating the transition.

public func setOn(_ on: Bool, animated: Bool)