uicolor - init(colorLiteralRed:,green:,blue:,alpha:) deprecated in Swift 4 -
let startingcolorofgradient = uicolor(colorliteralred: 255/255, green: 255/255, blue: 255/255, alpha: 1.0).cgcolor let endingcolorofgradient = uicolor(colorliteralred: 251/255, green: 247/255, blue: 234/255, alpha: 1.0).cgcolor let gradient: cagradientlayer = cagradientlayer()
error:
'init(colorliteralred:green:blue:alpha:)' obsoleted in swift 4.0 (swift._expressiblebycolorliteral)
how use gradient color if init(colorliteralred:,green:,blue:,alpha:)
deprecated in swift 4?
init(colorliteralred:green:blue:alpha:)
intended used color literals managed development tools.
why don't use normal init(red:green:blue:alpha:)
?
let startingcolorofgradient = uicolor(red: 255.0/255.0, green: 255.0/255.0, blue: 255.0/255.0, alpha: 1.0).cgcolor let endingcolorofgradient = uicolor(red: 251.0/255.0, green: 247.0/255.0, blue: 234.0/255.0, alpha: 1.0).cgcolor let gradient: cagradientlayer = cagradientlayer()
(writing 234.0/255.0
not mandatory, in context above in swift. prevents swift compiler interpret 234/255
integer division in other contexts.)
Comments
Post a Comment