Search code examples
swiftswiftuiaccessibilitysf-symbols

SwiftUI SF Symbols Accessibility


I'm trying to make my app more accessible for customers who are blind or low-vision. To minimize unnecessary information I am trying to remove VoiceOver for decorative images. In the following example VoiceOver reads "clock.arrow.circlepath"; which is maybe not very helpful.

For images it is possible to disable VoiceOver by using

Image(decorative: "image")

How can I do this for a system image (an SF Symbol)?

HStack {
    Image(systemName: "clock.arrow.circlepath")
        .frame(width: 30, height: 30)
        .foregroundColor(.orange)
        .padding(.trailing)
    Text(LocalizedStringKey(stringLiteral: "DeleteHistory"))
    Spacer()
}

Solution

  • The possible solution is to hide accessibility element, like

        Image(systemName: "clock.arrow.circlepath")
            .accessibility(hidden: true)
    

    Tested with Xcode 13beta / iOS15