|< How to detect the Reduce Motion accessibility setting||How to preview your layout at different Dynamic Type sizes >|
Fully updated for Xcode 11.2
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 Instabug helps you identify and resolve severe crashes quickly. You can retrace in-app events and know exactly which line of code caused the crash along with environment details, network logs, repro steps, and the session profiler. Ask more questions or keep users up-to-date with in-app replies straight from your dashboard. Instabug takes data privacy seriously, so no one sees your data but you! See more detailed features comparison and try Instabug's crash reporting SDK for free.