Contents

cgColor

A Core Graphics representation of the color, if available.

Declaration

var cgColor: CGColor? { get }

Discussion

You can get a CGColor instance from a constant SwiftUI color. This includes colors you create from a Core Graphics color, from RGB or HSB components, or from constant UIKit and AppKit colors.

For a dynamic color, like one you load from an Asset Catalog using init(_:bundle:), or one you create from a dynamic UIKit or AppKit color, this property is nil. To evaluate all types of colors, use the resolve(in:) method.