Hi I have a NSMutableArray and I try this:
var ma = NSMutableArray() let number:Int64 = 8345834344 ma.addObject(number)// Error "Type Int64 does not conform to protocol AnyObject"
How to add Int64 variable to NSMutableArray() ?
You are using a Foundation array (NSMutableArray), so you should use a Foundation number object:
ma.addObject(NSNumber(longLong:number))
You could also use a native swift array:
var ma = [Int64]() ma.append(number)
1.4m articles
1.4m replys
5 comments
57.0k users