2016-08-11 3 views
1

어떻게 스위프트에이 코드를 리팩토링 수 3?스위프트 3 해결되지 않은 식별자 CGColorGetComponents

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

이 엑스 코드 8 베타 4로 작동하지 않습니다하지만'cgColor.components'해야하는데 , 자세한 내용은 [이 Q & A를 참조하십시오] (http://stackoverflow.com/questions/38769322/xcode-8-beta-4-cgcolor-components-unavailable)를 참조하십시오. – Hamish

+0

getRed 메소드 apple-reference-documentation을 사용할 수 있습니다. // hsPr9ZXOsl –

답변

1
var r:CGFloat = 0, g:CGFloat = 0, b:CGFloat = 0, a:CGFloat = 0 
self.getRed(&r, green: &g, blue: &b:, alpha: &a) 
... 
관련 문제