[Solved] Unable to convert this Swift 2 code to Swift 3
That line should have failed under any version of Swift for being so unwieldily. First off, safely unwrap the optional. And only use one cast at the end. func isLight() -> Bool { if let components = self.cgColor.components { let brightness = CGFloat((components[0] * 299 + components[1] * 587 + components[2] * 114) / 1000) … Read more