Xcode doesn't correctly handle named colors defined outside the Main bundle
Asked Answered
B

0

12

The main goal is to create a module (framework) containing the basic UI components to be used into multiple Apps of the same company, but I have some issues with Xcode badly handling Assets (especially Named Colors supporting Dark and Light appearances) coming from external modules when they are used in Storyboards or XIB files.

It seems that Xcode doesn't correctly handle named color defined outside the main bundle, as already described in this nice blog post. More in details:

WHAT'S OK

  • The storyboard editor correctly show all defined named colors, no matter if they are defined locally or into another module of the workspace.
  • The storyboard preview inside Xcode is working fine, handling both Dark and Light interface styles.

WHAT'S NOT OK

  • The storyboard structure correctly contains as resources tha named colors, but doesn't include any Bundle reference, so I guess that it does the assumption that the colors are all available inside the Main bundle.
  • Running the project into the simulator, the local named colors work fine in both dark and light mode, but colors who are defined inside the ResourcesModule framework cannot be find, so iOS just use fallback color value defined inside the storyboard resources.

I prepared a repository to better show the issue: https://github.com/lechuckcaptain/TestResourcesIntoModule. More information are available into the README.MD.

Brunette answered 9/1, 2020 at 10:40 Comment(1)
3 iOS versions after the bug appearance and the issue still persists.. thanks for creating the repo btw :)Colonel

© 2022 - 2024 — McMap. All rights reserved.