how to give hex value as uicolor to background uiview in swift 5 code example
Example: uicolor from hex swift
extension UIColor {
convenience init(hexaString: String, alpha: CGFloat = 1) {
let chars = Array(hexaString.dropFirst())
self.init(red: .init(strtoul(String(chars[0...1]),nil,16))/255,
green: .init(strtoul(String(chars[2...3]),nil,16))/255,
blue: .init(strtoul(String(chars[4...5]),nil,16))/255,
alpha: alpha)}
}
let redColor = UIColor(hexaString: "#FF0000")
let transparentRed = UIColor(hexaString: "#FF0000", alpha: 0.5)