UIColor
extension UIColor
-
PowerUpSwift: Initializes a
UIColorbased from the hex value.Example
let color = UIColor(hex: "#FFFFFF")Declaration
Swift
public convenience init(hex: String)Parameters
hexThe hex string value similar to HTML.
-
PowerUpSwift: Initializes a
UIColorbased from the rgb/a value similar to HTML.Declaration
Swift
public convenience init(r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat? = 1.0)Parameters
rRed
gGreen
bBlue
aAlpha that defaults to
1.0if not provided. ### Exampleswift let color = UIColor(r: 255, g: 255, b: 255) let anotherColor = UIColor(r: 0, g: 0, b: 0, a: 0.5)
UIColor Extension Reference