Updated for Xcode 14.1
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("star") 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 In-app subscriptions are a pain to implement, hard to test, and full of edge cases. RevenueCat makes it straightforward and reliable so you can get back to building your app. Oh, and it's free if your app makes less than $10k/mo.
Link copied to your pasteboard.