A convenient way to convert hex strings to UIColor or NSColor. HexColor support RGB 、ARGB and RGBA hex strings. In addition, HexColor will cache hex color for reusing which can improve performance.
RGB hex string
let red = UIColor.hexColor("FF0000")
let green = UIColor.hexColor("#00FF00")
let blue = UIColor.hexColor("0000FF")
ARGB hex string
let aquaAlpha = UIColor.hexColor("99D4F2E7")
let yellowAlpha = UIColor.hexColor("88FFFF00")
RGBA hex string
let aquaAlpha = UIColor.hexColor("D4F2E799", type: .ARGB)
let yellowAlpha = UIColor.hexColor("FFFF0088", type: .ARGB)
Set Color cache count limit
// default is 100
UIColor.cacheCountLimit = 200
pod 'IRHexColor'
Drag and drop HexColor.swift file into your project