Class

WKInterfaceSeparator

An interface object that displays a visual separator within a group.

Overview

Use WKInterfaceSeparator to manipulate a separator at runtime, such as changing its color. You can also use the inherited methods to show or hide it and configure other attributes.

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 separator object in your interface, define a property with the following syntax in your interface controller class:

@IBOutlet weak var mySeparator: WKInterfaceSeparator!

During the initialization of your interface controller, WatchKit creates any needed separator objects and assigns them to their connected outlets. At that point, you can use those objects to make changes to the onscreen text.

Additional Information About Separators in watchOS 1

In watchOS 1, WatchKit coalesces the data from all setter method calls made during the same run loop iteration and transmits that data to the user’s Apple Watch at the end of the run loop. If you set an attribute to different values in the same run loop iteration, only the last value is transmitted. If you set an attribute to the same value in the same run loop iteration, WatchKit generates a log message so that you can track down the duplicate change.

Interface Builder Configuration Options

Xcode lets you configure information about your separator interface object in your storyboard file. Table 1 lists the attributes you can configure and their meaning.

Table 1

WatchKit separator attributes

Attribute

Description

Color

The default color of the separator. You can also set this value programmatically using the setColor(_:) method.

Topics

Configuring the Separator

func setColor(UIColor?)

Sets the color of the separator bar.

Relationships

Inherits From

Conforms To

See Also

Containers

class WKInterfaceGroup

A container for one or more interface objects.

class WKInterfaceTable

An object that creates and manages the contents of a single-column table interface.

class WKInterfacePicker

An interface element that presents a scrolling list of items for the user to choose from.