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?

code

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

enter image description here

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

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -