Question : hex color swiftui
Answered by : sirchamallow
"Color sets can be added in the Assets.xcassets of your project, which you can use throughout your views."
Source : | Last Update : Fri, 20 May 22
Question : swift hex color
Answered by : sarwar
//https://stackoverflow.com/questions/24263007/how-to-use-hex-color-values
var color1 = hexStringToUIColor("#d3d3d3")
//Create Func
func hexStringToUIColor (hex:String) -> UIColor { var cString:String = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased() if (cString.hasPrefix("#")) { cString.remove(at: cString.startIndex) } if ((cString.count) != 6) { return UIColor.gray } var rgbValue:UInt64 = 0 Scanner(string: cString).scanHexInt64(&rgbValue) return UIColor( red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0, green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0, blue: CGFloat(rgbValue & 0x0000FF) / 255.0, alpha: CGFloat(1.0) )
}
Source : https://stackoverflow.com/questions/24263007/how-to-use-hex-color-values | Last Update : Sat, 20 Feb 21