I\'m trying to change a SwiftUI Color to an instance of UIColor.
I can easily get the RGBA from the UIColor, but I don\'t know how to get the "Color" instan
There is a new initializer that takes a Color
and returns a UIColor
for iOS or NSColor
for macOS now. So:
UIColor(Color.red)
NSColor(Color.red)
UIColor(Color.red).cgColor /* For iOS */
NSColor(Color.red).cgColor /* For macOS */
If you are looking for color components, you can find my helpful extensions here in this answer