Swift 3, неразрешенный идентификатор CGColorGetComponents

Как я могу изменить этот код в Swift 3?:

    extension UIColor {
        var hexString: String {
            // Produces "Use of unresolved identifier 'CGColorGetComponents'"
            let components = CGColorGetComponents(self.cgColor)
            ....
        }
    }

1 ответ

var r:CGFloat = 0, g:CGFloat = 0, b:CGFloat = 0, a:CGFloat = 0
self.getRed(&r, green: &g, blue: &b:, alpha: &a)
...
Другие вопросы по тегам