Swift: NSNumber is not a subtype of Float -
i tried code swift programming language in playground , got following error "nsnumber not subtype of float", modified making x , y of type float in struct point. missing?

if added float type centerx , centery, got error: not find overload '/' accepts supplied arguments.

the error message unrelated actual error... actual error cannot convert double float.
in size, x , y double (default type of float literal) in point, width , height float. different types , can't mix them without explicit conversion.
there number of ways fix it. can change them double or float.
e.g.
class point { var x:double var y:double } or can convert them correct type doing float(centerx)
ps: can post code next time can change without retype them
Comments
Post a Comment