'NSNumber' is not convertible to 'Int' Swift -
i trying math set position of shape node. looks (swift): var score: nsnumber? score = score! + 1
xcode 6 beta 5 run perfect, xocde 6.1 not run, study 'nsnumer' not convertible 'int'
i realize older question, , have figure out already, having similar issues myself recently, figured i'd post reply posterity.
swift (as far know) still undergoing design changes programming language, , 1 thing noticed needed start wrapping int's within int() function. illustration might need this:
var score: nsnumber? score = nsnumber(integer:score!) + 1 edit:
to seek , explain why need this, believe, because score nsnumber(), can have various numeric forms. nsnumber(integer:score!) re-wraps score! integer specifically, allowing utilize integers against in math equations.
int nsnumber
No comments:
Post a Comment