Fully updated for Xcode 11.4
SwiftUI automatically uses the names of your images for screen reader labels, which is helpful if you have image names like “Photo of Paul Hudson” or “Hacking with Swift logo.” However, some images aren’t meant to be read because they are merely decorative – they don’t convey information that isn’t already elsewhere on the screen, or are instead just there to make the user interface look more attractive.
If you create these images using something like
Image("BulletPoint") the screen reader will read them out as part of its standard UI pass. A better idea is to create them using using the
Image(decorative:) initializer, which tells SwiftUI the image shouldn’t be exposed to the screen reader:
Once you’ve built your user interface it’s worth doing a final check over using VoiceOver to make sure you have marked your images correctly – the last thing you want is the screen reader speaking out weird internal filenames that you thought were only used in your code!
SPONSORED Catch bugs as soon as they happen and know exactly why a crash occurred by integrating Instabug's SDK in one minute. You will automatically receive device data, network logs, and reproduction steps with every bug and crash report.
Link copied to your pasteboard.