ios - CGFloat in Swift 2.0 -
after updating swift 2.0 need fix code. automatic correction doesn't work.
func getvalueforkey(key: string) -> cgfloat { var inch = "" if screensize.height == 480 { // iphone 4, 4s , below inch = "3.5" } else if screensize.height == 568 { // iphone 5, 5s inch = "4" } else if screensize.width == 375 { // iphone 6 inch = "4.7" } else if screensize.width == 414 { // iphone 6+ inch = "5.5" } else if screensize.width == 768 { // ipad inch = "5.5+" } let result = values["\(key)\(inch)"]! // println("\(key) - \(result)") return result } i have changed it. nothing happens , appears again!
how fix it?
to elaborate on why importing uikit fixes problem:
the cgfloat struct part of coregraphics framework. uikit default imports foundation imports coregraphics.
if weren't using uikit or on platform doesn't have uikit framework (such linux), importing foundation module import coregraphics.

Comments
Post a Comment