An interface element that lets users control the audio volume from the watch or a paired iPhone.
- watchOS 5.0+
Configure your app's audio source and the appearance of the volume control in your storyboard file. Use the
WKInterface instance to change the volume’s tint color at runtime.
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 volume control 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 control.
After selecting the volume control, the user can increase or decrease the audio’s volume using the crown. The system automatically handles changing the audio source’s volume. You cannot access or change the volume programmatically in your app.
Interface Builder Configuration Options
Xcode lets you configure your volume control in your storyboard file. Table 1 lists the attributes you can configure and their meaning.
Controls Local Volume
The volume control’s audio source. If checked, the control affects the volume of long-form audio playing on the watch. If unchecked, it affects the volume of audio playing on the paired iPhone.
You must set this value at design time. You cannot change its value programmatically.
The tint color for the volume control. By default, the system uses the application’s tint color.
The system only applies the tint color to the control’s default state (when the crown is not being used to adjust the volume).
You can change this value programmatically using the