Merge pull request #10 from jufabeck2202/Uint64

'scanHexInt32' was deprecated in iOS 13.0
This commit is contained in:
Andras Samu
2019-10-15 09:40:19 +02:00
committed by GitHub
+3 -3
View File
@@ -143,9 +143,9 @@ class TestData{
extension Color {
init(hexString: String) {
let hex = hexString.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
var int = UInt32()
Scanner(string: hex).scanHexInt32(&int)
let r, g, b: UInt32
var int = UInt64()
Scanner(string: hex).scanHexInt64(&int)
let r, g, b: UInt64
switch hex.count {
case 3: // RGB (12-bit)
(r, g, b) = ((int >> 8) * 17, (int >> 4 & 0xF) * 17, (int & 0xF) * 17)