RTL image flipping

Not sure if this should be here or in the XCode subforum, but anyway:


I'm trying to get image flipping to work reliably, but i'm seeing some issues. I manage my images in an XCode asset catalog, and the ones that need to be flipped in RTL languages have been configured with the 'Direction' property set to 'Left to right, Mirrors'.

In some cases I have 2 separate assets, since flipping was not enough. Those are configured with the 'Direction' property set to 'Both' and two separate image assets are provided. All images are PDF assets with 'Preserve vector data' enabled.

This all worked great as long as I test with iOS 11 and XCode 9.2. The problems start when I test on iOS 9. Images that are configured for RTL don't show up when I launch the app, even when I'm not running in a RTL language.


Since XCode 9.3, I seem to have a new problem. The asset catalogs get updated automatically; the RTL images are reconfigured to direction 'Both' and changes are made to the json files in the catalog. Selecting 'Left to right, Mirrors' does not work anymore.


Is there some way to get this to work again?

Accepted Reply

>> The problems start when I test on iOS 9.


If your deployment target version is iOS 9, you can't use features that weren't available in iOS 9. In a brief search of the documentation, I couldn't find a clear statement of when asset catalog images started supporting layout direction, but it kinda looks like iOS 10.


If that's true, then Xcode 9.3 seems to fix the "bug" in 9.2 that let you create images with layout directions that weren't compatible with your deployment target.


So, you need to verify what version of iOS supports this feature, then either set your deployment target to that version, or find a way to code around the problem.

Replies

After further analysis of the IPA file that is generated, it seems that the Assets.car file does not contain .png files for the RTL images. It seems that they are not generated (since the source files are PDF), so that would explain the missing images in iOS 9 (which does not use PDF images).

I guess this points to a bug in XCode build tools?

>> The problems start when I test on iOS 9.


If your deployment target version is iOS 9, you can't use features that weren't available in iOS 9. In a brief search of the documentation, I couldn't find a clear statement of when asset catalog images started supporting layout direction, but it kinda looks like iOS 10.


If that's true, then Xcode 9.3 seems to fix the "bug" in 9.2 that let you create images with layout directions that weren't compatible with your deployment target.


So, you need to verify what version of iOS supports this feature, then either set your deployment target to that version, or find a way to code around the problem.

>The problems start when I test on iOS 9.


Looks like asset catalog/direction started w/Xcode 8.0, which was when iOS 10 support was rolled out.


I found at least one openradar from Jan. requesting that direction be disallowed when using unsupported deployment OS:

h ttps://github.com/lionheart/openradar-mirror/issues/19167


Might want to either file a bug against the docs or the tools.

I'd assume you'll need to forego iOS 9 support.

Thanks!

I incorrectly assumed this would work (since most RTL features are iOS9+, like imageFlippedForRightToLeftLayoutDirection).

I will code my way around it and/or ask the art department to deliver flipped images 🙂