ColorAssetCatalog icon indicating copy to clipboard operation
ColorAssetCatalog copied to clipboard

Can't find asset Color in framework bundle

Open txuslee opened this issue 9 years ago • 1 comments

Hi! I've using ColorAssetCatalog without any issue until I moved Colors.xcassets into a framework I've been working on: it looks like both the iOS11 asset color loader and ColorAssetCatalog are loading resources from the main bundle.

So, when you try to load an asset color by name UIColor(asset: "StatusOnline") the constructor returns nil.

One of the system UIColor constructors allows to load an asset color from a different bundle: public init?(named name: String, in bundle: Bundle?, compatibleWith traitCollection: UITraitCollection?)

txuslee avatar Oct 30 '17 16:10 txuslee

Added init?(asset name: String, in bundle: Bundle?, compatibleWith traitCollection: UITraitCollection?) and ColorAssetManager.shared.bundle property. Thanks!

samrayner avatar Nov 12 '17 11:11 samrayner