Initializer

init(named:)

Creates a color object using the information stored in the named asset.

Declaration

init?(named name: String)

Parameters

name

The name of the asset containing the color.

Return Value

An initialized color object. The returned object uses the color space specified for the asset.

See Also

Creating a Custom UIColor Object in a Specific Color Space

init(white: CGFloat, alpha: CGFloat)

Initializes and returns a color object using the specified opacity and grayscale values.

init(hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat)

Initializes and returns a color object using the specified opacity and HSB color space component values.

init(red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat)

Initializes and returns a color object using the specified opacity and RGB component values.

init(displayP3Red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat)

Initializes and returns a color object using the specified opacity and RGB component values in the Display P3 color space.

init?(named: String, in: Bundle?, compatibleWith: UITraitCollection?)

Creates a color object using the named asset that is compatible with the specified trait collection.