Improving the Accessibility of RealityKit Apps
Incorporate assistive technologies in your augmented reality app.
Overview
To support assistive technologies such as VoiceOver in your RealityKit apps, set the properties on each visible Entity in your scene. You can configure accessibility in Reality Composer, and in code.
Configure accessibility in Reality Composer
When you create a scene in Reality Composer, you can configure the accessibility properties of your entities right in the properties inspector. Select one or more entities in your scene and click the Accessibility Enabled checkbox in the properties inspector. In the Label field, give the entity a name to be used by assistive technologies. In the Detailed Description field, you can optionally add a more in-depth description.
[Image]
Configure accessibility in code
You can also configure entities to work with assistive technologies in code. To enable accessibility support for an Entity, set its isAccessibilityElement property to True and provide a short descriptive name using accessibilityLabel. If you want to provide a more detailed description, set accessibilityDescription.
Because these properties were introduced in iOS 14, any code that sets or reads their values should be wrapped in an availability macro if your project’s deployment target is iOS 13. Setting these values on an older version of iOS results in a runtime exception.
if #available(iOS 14.0, *) {
ball.isAccessibilityElement = true
ball.accessibilityLabel = "a bowling ball"
ball.accessibilityDescription = "Tap and drag to roll the ball towards the pins."
}