You can create your own accessibility elements from scratch. One use-case for doing that is when you do some custom drawing instead of building your UI using or relying on UIKit components. A circular progress bar, could be an example.

Two examples. The first one is the calendar app in iOS. Let's imagine that each one of the week's rows are customary drawn, but we'd like for each day to be an accessibility element. We could mark the week’s container view not to be an accessibility element and then create a UIAccessibilityElement for each day. These will need an accessibility label and the accessibility frame in the container space. Then we can add all the newly created elements to the accessibilityElements array of the container. The second example is a circular progress bar drawn using UIBezierPath. We could follow a similar approach for making it accessible.

You may also find interesting...

Apple asks us to consider the combine behavior, before using ignore, for .accessibilityElement(children: ). And for good reason, if combine works, and later on you decide to change the UI, the accessibility attributes will be updated for you.

As with UIKit, in SwiftUI you can also add/remove a11y traits. But because of its declarative nature, you'll have to approach it in a slightly different way. A little nuance, but something that made me scratch my UIKit head when learning SwitUI.

When making charts accessible, sometimes you may have just too many data points for the user to have to go one by one through all of them. In those cases, you can create accessibility elements that represent meaningful chunks of the graph.

Created in Swift with Ignite.

Supporting Swift for Swifts