<!--
{
  "availability" : [
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WatchKit",
  "identifier" : "/documentation/WatchKit/WKInterfaceObject",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "WatchKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WKInterfaceObject"
  },
  "title" : "WKInterfaceObject"
}
-->

# WKInterfaceObject

An object that provides information that is common to all interface objects in your watchOS app.

```
class WKInterfaceObject
```

## Overview

Your WatchKit extension uses interface objects to manipulate the visual elements displayed on Apple Watch. Specifically, you use the methods of this class to change the size, alignment, and visibility of those elements. You can also configure the accessibility information displayed through assistive technologies like VoiceOver.

Do not subclass or create instances of this class, or any of its subclasses, 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 button in your interface, define a property with the following syntax in your interface controller class:

```swift
@IBOutlet weak var button: WKInterfaceButton!
```

At runtime, WatchKit creates the appropriate interface objects and assigns them to the outlets in your interface controller.

WatchKit provides one-way communication between the interface objects in your extension and the corresponding interface elements in your watchOS app. You can set the values of an interface object, but you cannot get the current values. If you want to know the current value of an attribute, you must save the value yourself.

### Interface Builder Configuration Options

Xcode lets you configure information about your group interface object in your storyboard file. The following table lists the attributes you can configure in your storyboard and their meaning.

|Attribute |Description                                                                                                                                                                                                                      |
|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|Alpha     |The opacity of the object. A value of `1.0` represents fully opaque and a value of `0.0` represents fully transparent.                                                                                                           |
|Hidden    |A checkbox indicating whether the item is hidden initially. You can change the visibility of the item programmatically by calling the ``doc://com.apple.watchkit/documentation/WatchKit/WKInterfaceObject/setHidden(_:)`` method.|
|Installed |A checkbox indicating whether the item is installed for the current device.                                                                                                                                                      |
|Horizontal|The horizontal alignment of the item. Use this attribute to configure the horizontal position of the item relative to its immediate parent.                                                                                      |
|Vertical  |The vertical alignment of the item. Use this attribute to configure the vertical position of the item relative to its immediate parent.                                                                                          |
|Width     |The width of the object. Specify a fixed width or set the value of the object to be a percentage of its container’s width.                                                                                                       |
|Height    |The height of the object. Specify a fixed height or set the value of the object to be a percentage of its container’s height.                                                                                                    |

## Topics

### Hiding and Showing an Object

[`-  setHidden:`](/documentation/WatchKit/WKInterfaceObject/setHidden(_:))

Hides or shows the interface object in your user interface.

[`-  setAlpha:`](/documentation/WatchKit/WKInterfaceObject/setAlpha(_:))

Sets the opacity of the interface object.

### Getting the Property Name

[`interfaceProperty`](/documentation/WatchKit/WKInterfaceObject/interfaceProperty)

The name of the outlet in your interface controller to which the object is bound.

### Changing an Object’s Size

[`-  setWidth:`](/documentation/WatchKit/WKInterfaceObject/setWidth(_:))

Sets the absolute width (in points) of the object.

[`-  setHeight:`](/documentation/WatchKit/WKInterfaceObject/setHeight(_:))

Sets the absolute height (in points) of the object.

[`-  setRelativeWidth:withAdjustment:`](/documentation/WatchKit/WKInterfaceObject/setRelativeWidth(_:withAdjustment:))

Sets the width of the object relative to its container.

[`-  setRelativeHeight:withAdjustment:`](/documentation/WatchKit/WKInterfaceObject/setRelativeHeight(_:withAdjustment:))

Sets the height of the object relative to its container.

[`-  sizeToFitWidth`](/documentation/WatchKit/WKInterfaceObject/sizeToFitWidth())

Sets the width of the object to fit its current content.

[`-  sizeToFitHeight`](/documentation/WatchKit/WKInterfaceObject/sizeToFitHeight())

Sets the height of the object so that it fills the available vertical space.

### Setting an Object’s Alignment

[`-  setHorizontalAlignment:`](/documentation/WatchKit/WKInterfaceObject/setHorizontalAlignment(_:))

Sets the horizontal alignment of an object relative to its container’s bounds.

[`-  setVerticalAlignment:`](/documentation/WatchKit/WKInterfaceObject/setVerticalAlignment(_:))

Sets the vertical alignment of an object relative to its container’s bounds.

### Configuring the Accessibility Attributes

[`-  setAccessibilityIdentifier:`](/documentation/WatchKit/WKInterfaceObject/setAccessibilityIdentifier(_:))

Sets the unique identifier string for the interface object.

[`-  setAccessibilityLabel:`](/documentation/WatchKit/WKInterfaceObject/setAccessibilityLabel(_:))

Sets a succinct label on the object that identifies the accessibility element.

[`-  setAccessibilityHint:`](/documentation/WatchKit/WKInterfaceObject/setAccessibilityHint(_:))

Sets the description of what happens when performing an action on the accessibility element.

[`-  setAccessibilityValue:`](/documentation/WatchKit/WKInterfaceObject/setAccessibilityValue(_:))

Sets the value of the accessibility element.

[`-  setIsAccessibilityElement:`](/documentation/WatchKit/WKInterfaceObject/setIsAccessibilityElement(_:))

Sets whether the object is an accessibility element that an assistive app can access.

[`-  setAccessibilityTraits:`](/documentation/WatchKit/WKInterfaceObject/setAccessibilityTraits(_:))

Sets the combination of accessibility traits that best characterize the accessibility element.

[`-  setAccessibilityImageRegions:`](/documentation/WatchKit/WKInterfaceObject/setAccessibilityImageRegions(_:))

Marks portions of an image as separate accessible elements.

### Setting the Layout Direction

[`-  setSemanticContentAttribute:`](/documentation/WatchKit/WKInterfaceObject/setSemanticContentAttribute(_:))

Sets the semantic description of the object’s contents, used to determine whether its content should be flipped when switching between left-to-right and right-to-left layouts.

### Constants

[`WKInterfaceObjectHorizontalAlignment`](/documentation/WatchKit/WKInterfaceObjectHorizontalAlignment)

Constants for horizontally aligning objects in their container.

[`WKInterfaceObjectVerticalAlignment`](/documentation/WatchKit/WKInterfaceObjectVerticalAlignment)

Constants for vertically aligning objects in their container.

## Relationships

### Inherited By

[`WKInterfaceTimer`](/documentation/WatchKit/WKInterfaceTimer)

[`WKInterfaceTable`](/documentation/WatchKit/WKInterfaceTable)

[`WKInterfaceSwitch`](/documentation/WatchKit/WKInterfaceSwitch)

[`WKInterfaceHMCamera`](/documentation/WatchKit/WKInterfaceHMCamera)

[`WKInterfaceSlider`](/documentation/WatchKit/WKInterfaceSlider)

[`WKInterfaceInlineMovie`](/documentation/WatchKit/WKInterfaceInlineMovie)

[`WKInterfaceLabel`](/documentation/WatchKit/WKInterfaceLabel)

[`WKInterfaceButton`](/documentation/WatchKit/WKInterfaceButton)

[`WKInterfaceGroup`](/documentation/WatchKit/WKInterfaceGroup)

[`WKInterfacePicker`](/documentation/WatchKit/WKInterfacePicker)

[`WKInterfaceActivityRing`](/documentation/WatchKit/WKInterfaceActivityRing)

[`WKInterfaceSeparator`](/documentation/WatchKit/WKInterfaceSeparator)

[`WKInterfaceAuthorizationAppleIDButton`](/documentation/WatchKit/WKInterfaceAuthorizationAppleIDButton)

[`WKInterfacePaymentButton`](/documentation/WatchKit/WKInterfacePaymentButton)

[`WKInterfaceMap`](/documentation/WatchKit/WKInterfaceMap)

[`WKInterfaceImage`](/documentation/WatchKit/WKInterfaceImage)

[`WKInterfaceSCNScene`](/documentation/WatchKit/WKInterfaceSCNScene)

[`WKInterfaceTextField`](/documentation/WatchKit/WKInterfaceTextField)

[`WKInterfaceDate`](/documentation/WatchKit/WKInterfaceDate)

[`WKInterfaceMovie`](/documentation/WatchKit/WKInterfaceMovie)

[`WKInterfaceVolumeControl`](/documentation/WatchKit/WKInterfaceVolumeControl)

[`WKInterfaceSKScene`](/documentation/WatchKit/WKInterfaceSKScene)

### Conforms To

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Equatable`](/documentation/Swift/Equatable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)