You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
assert(getRed(&r, green: &g, blue: &b, alpha: &a), "Unable to get RGB channels from UIColor")
If the build settings do not enable testing, the compiler (Xcode 12.1) appears to optimize the code by removing this line, and the result is every color gets the string "000000"
Recommend splitting this line into 2, one to call getRed() and another to assert on the result of the previous call. Here is an alternate computed var implementation that might replace the existing method:
var hexString: String {
var red: CGFloat = 0
var green: CGFloat = 0
var blue: CGFloat = 0
var alpha: CGFloat = 0
let success = getRed(&red, green: &green, blue: &blue, alpha: &alpha)
assert(success, "Unable to get RGB channels from UIColor")
return String(format: "%02X%02X%02X", Int(red * 255), Int(green * 255), Int(blue * 255))
}
The text was updated successfully, but these errors were encountered:
The subject method has this line:
If the build settings do not enable testing, the compiler (Xcode 12.1) appears to optimize the code by removing this line, and the result is every color gets the string "000000"
Recommend splitting this line into 2, one to call
getRed()
and another to assert on the result of the previous call. Here is an alternate computed var implementation that might replace the existing method:The text was updated successfully, but these errors were encountered: