---
title: WKInterfaceSwitch
framework: watchkit
role: symbol
role_heading: Class
path: watchkit/wkinterfaceswitch
---

# WKInterfaceSwitch

An interface element that toggles between an On and Off state.

## Declaration

```swift
class WKInterfaceSwitch
```

## Overview

Overview Switches are commonly used to indicate whether a feature is enabled or disabled. You set the initial value of the switch in your storyboard file, but you can modify that value at runtime using the methods of this class. Do not subclass or create instances of this class yourself. Instead, define outlets in your interface controller class and connect them to the corresponding objects in your storyboard file. For example, to refer to a switch object in your interface, define a property with the following syntax in your interface controller class: During the initialization of your interface controller, WatchKit creates a new instance of this class and assigns it to your outlet. At that point, you can use the object in your outlet to make changes to the onscreen switch. When the user changes the value of a switch, WatchKit delivers the new value to the slider’s action method. The format of a switch’s action method is as follows: Declare a method of this form in the interface controller class used to manage the switch. You can change the method name to anything you like. When configuring the switch in Xcode, connect its selector to your custom action method. Interface Builder Configuration Options Xcode lets you configure information about switches in your storyboard file. The following table lists the attributes you can configure and their meaning.  |   |   |   |   |   |   |

## Topics

### Setting the Switch’s Title

- [setTitle(_:)](watchkit/wkinterfaceswitch/settitle(_:).md)
- [setAttributedTitle(_:)](watchkit/wkinterfaceswitch/setattributedtitle(_:).md)

### Configuring the Switch

- [setOn(_:)](watchkit/wkinterfaceswitch/seton(_:).md)
- [setColor(_:)](watchkit/wkinterfaceswitch/setcolor(_:).md)

### Enabling the Switch

- [setEnabled(_:)](watchkit/wkinterfaceswitch/setenabled(_:).md)

## Relationships

### Inherits From

- [WKInterfaceObject](watchkit/wkinterfaceobject.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Controls

- [WKInterfaceLabel](watchkit/wkinterfacelabel.md)
- [WKInterfaceDate](watchkit/wkinterfacedate.md)
- [WKInterfaceTimer](watchkit/wkinterfacetimer.md)
- [WKInterfaceButton](watchkit/wkinterfacebutton.md)
- [WKInterfaceAuthorizationAppleIDButton](watchkit/wkinterfaceauthorizationappleidbutton.md)
- [WKInterfacePaymentButton](watchkit/wkinterfacepaymentbutton.md)
- [WKInterfaceTextField](watchkit/wkinterfacetextfield.md)
- [WKInterfaceSlider](watchkit/wkinterfaceslider.md)
- [WKInterfaceActivityRing](watchkit/wkinterfaceactivityring.md)
- [WKInterfaceMap](watchkit/wkinterfacemap.md)
