Search code examples
iosswiftxcodeuiaccessibilityasset-catalog

How to set the accessibility label in asset catalog? Xcode 11


Is there any way to set the accessibilityLabel for an image asset inside the asset cataloge? I don't want to handle that label everywhere I use that image asset.


Solution

  • Is there any way to set the accessibilityLabel for an image asset inside the asset catalog?

    The .xcassets is definitely not done for this purpose.

    However, you can create a new UIView including the image you're using everywhere so as to define the accessibilityLabel in it once for all.

    You use this new UIView in place of the image coming from your asset catalog and you don't have to handle that label everywhere. 😉