swift3 - Swift 3 Convert Double to String -
i keep getting error "initializer conditional binding must have optional type, not 'double'". trying display core data values , 1 double. ive tried work around same way had store values when converting it.
heres code gives me error:
func displaystats() { // display other attributes if have values if let servingsize = mealstats.serving { servingslabel.text = servingsize }
mealstats.serving of type "double" , not "double?"
since not optional cannot unwrapped. right way use be
func displaystats() { // display other attributes if have values servingslabel.text = "\(mealstats.serving)" }
Comments
Post a Comment