swift - How to cast from UInt16 to NSNumber -


i have uint16 variable pass legacy function requires nsnumber.

if try:

var castasnsnumber : nsnumber = myuint16 

i compiler error 'uint16' not convertible 'nsnumber'

question

how can recast nsnumber?

var castasnsnumber = nsnumber(unsignedshort: myuint16) 

Comments

Popular posts from this blog

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -