Hi there,
I have a shared framework between my iOS and watchOS apps which contains an asset catalog with some named colors. I'd like to access the named colors in my watchOS app. In iOS, I can use UIColor.init(named name: String, in bundle: Bundle, compatibleWith traitCollection: UITraitCollection) to tell the system to access the name from the passed-in Bundle.
watchOS also claims to have this initializer available since watchOS 4; however, Xcode autocomplete doesn't find it, I get a build error when I try to use it, and it's a bit odd because UITraitCollection (which is part of that method signature) isn't exposed to us in watchOS anyhow.
How can I access an asset from the asset catalog in my shared framework?
I have a shared framework between my iOS and watchOS apps which contains an asset catalog with some named colors. I'd like to access the named colors in my watchOS app. In iOS, I can use UIColor.init(named name: String, in bundle: Bundle, compatibleWith traitCollection: UITraitCollection) to tell the system to access the name from the passed-in Bundle.
watchOS also claims to have this initializer available since watchOS 4; however, Xcode autocomplete doesn't find it, I get a build error when I try to use it, and it's a bit odd because UITraitCollection (which is part of that method signature) isn't exposed to us in watchOS anyhow.
How can I access an asset from the asset catalog in my shared framework?