Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

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
Comment

swift ui color rgb

let exampleColor : Color = Color(red: 141/255, green: 223/255, blue: 144/255)
Comment

PREVIOUS NEXT
Code Example
Swift :: firestore subcollection swift 
Swift :: round up swift 
Swift :: how to get the last element of an array in swift 
Swift :: swift convert data to dictionary 
Swift :: save codable in userdefaults ios swift 
Swift :: get index filter swift 
Swift :: swift uiview gradient 
Swift :: swift remove tableview cell 
Swift :: swiftui steppers 
Swift :: append new element to dictionary in swift 
Swift :: swift reload tableview 
Swift :: and in swift 
Swift :: listview swiftui 
Swift :: swift print 
Swift :: swift convert base64 string to data 
Swift :: swift calendar components 
Swift :: change placeholder color swift 
Swift :: add shadow to specific corner of UIView with shadow swift 6 site:stackoverflow.com 
Swift :: check notification permission ios swift 
Swift :: Swift Create an Empty Set 
Swift :: response.result.value alamofire 5 
Swift :: Swift Closure Parameters 
Swift :: swift enum nib 
Swift :: Swiftui run action before navigationlink inside on button 
Swift :: Swift Assignment Operators 
Swift :: Swift enum With Associated Values 
Swift :: swift variables 
Swift :: rust How to pass out parameter to function from Swift FFI 
Swift :: chevrondownf6a06a60-2122-49d0-86a0-03ba8c532aec 
Swift :: Swift Comparison Operators 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =