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") // r 1,0 g 0,0 b 0,0 a 1,0
let transparentRed = UIColor(hexaString: "#FF0000", alpha: 0.5) // r 1,0 g 0,0 b 0,0 a 0,5
Also in Swift:
- string.format swift
- how to swift pie chart quartzcore framework
- how to get index path cell collection view from ui longpress gesture swift
- swift ways to setup constraints
- create protocol swift
- xcode disable a button
- textField.characther range
- cross origin requests are only supported for http wkwebview
- list header swiftui
- swift convert string to ns muteable string
- how to delete from list tvos swiftui coredata
- textchange in textview swift
- swift create array from range
- uitextfield placeholder text
- Close iOS Keyboard by touching anywhere using Swift
- uilabel center text programmatically swift
- conert data to string swift
- check when webview finish loading swift
- play sound swift stack overflow
- swift update uilabel text button
- format decimal place swift
- xcode enable a button after a text field is filled
- swift reload tableviewcell at index
- loop through array swift