UIColor
-
Initializer for the UIColor with hex code.
Usage Example
let aColor :UIColor = UIColor(hexString: "#FF0000")
Declaration
Swift
convenience init(hexString pHexString:String)
-
Variable to get red component of the color.
Usage Example
let aColor :UIColor = UIColor(red: 128.0/255.0, green: 128.0/255.0, blue: 128.0/255.0, alpha: 1.0) aColor.redComponent
Note
If the color does not have red component, the variable will return nil.
See also
var greenComponent :CGFloat?
var blueComponent :CGFloat?
var alphaComponent :CGFloat?
Declaration
Swift
public var redComponent :CGFloat?
-
Variable to get green component of the color.
Usage Example
let aColor :UIColor = UIColor(red: 128.0/255.0, green: 128.0/255.0, blue: 128.0/255.0, alpha: 1.0) aColor.greenComponent
Note
If the color does not have green component, the variable will return nil.
See also
var redComponent :CGFloat?
var blueComponent :CGFloat?
var alphaComponent :CGFloat?
Declaration
Swift
public var greenComponent :CGFloat?
-
Variable to get blue component of the color.
Usage Example
let aColor :UIColor = UIColor(red: 128.0/255.0, green: 128.0/255.0, blue: 128.0/255.0, alpha: 1.0) aColor.blueComponent
Note
If the color does not have blue component, the variable will return nil.
See also
var redComponent :CGFloat?
var greenComponent :CGFloat?
var alphaComponent :CGFloat?
Declaration
Swift
public var blueComponent :CGFloat?
-
Variable to get alpha component of the color.
Usage Example
let aColor :UIColor = UIColor(red: 128.0/255.0, green: 128.0/255.0, blue: 128.0/255.0, alpha: 1.0) aColor.alphaComponent
Note
If the color does not have alpha component, the variable will return nil.
See also
var redComponent :CGFloat?
var greenComponent :CGFloat?
var blueComponent :CGFloat?
Declaration
Swift
public var alphaComponent :CGFloat?