Contents

UISwitch

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

Declaration

@MainActor class UISwitch

Mentioned in

Overview

The UISwitch class declares a property and a method to control its on/off state. When a person manipulates the switch control (“flips” it), it triggers the valueChanged event.

You can customize the appearance of the switch by changing the color used to tint the switch when it’s on or off.

For information about basic view behaviors, see View Programming Guide for iOS.

Topics

Creating a switch

Setting the on/off state

Setting the display style

Customizing the appearance of the switch

Deprecated

See Also

Controls