UIColor
public extension UIColor
-
Initializes and returns a random color object using the specified opacity and RGB component values.
Declaration
Swift
static var random: UIColor { get }
-
Initializes and returns a random color object using the specified opacity and RGB component values in the Display P3 color space.
Declaration
Swift
static var p3Random: UIColor { get }
-
Possible errors for UIColor Hexadecimal extension
See moreDeclaration
Swift
enum HexCodeError : Error
-
Initializes a new
UIColor
from itsHexadecimal
representation.Throws
HexCodeError
.Declaration
Swift
convenience init(hex code: String) throws
Parameters
code
The
Hexadecimal
representation from which to extract the code.
-
Initializes a UIColor from an array of CGFloat components if possible, otherwise returns nil.
Declaration
Swift
convenience init?(components: [CGFloat]?)
Parameters
components
The components making up the UIColor. Either [red, green, blue] or [red, green, blue, alpha].