user1256276
user1256276

Reputation: 143

Swift 3 : Ambiguous use of mutablecopy

When i migrated the code from swift 2.3 to 3.0, its throwing an error as below:
let dictionary = (self.testArray!.object(at: i) as AnyObject).mutableCopy() How to resolve this issue.

Upvotes: 0

Views: 734

Answers (1)

vadian
vadian

Reputation: 285069

Do not use mutableCopy in Swift. The var keyword makes objects mutable

var dictionary = self.testArray![i] as! [String:Any] 

And don't use Foundation collection types (NSArray / NSDictionary) in Swift either.
Use native types.

Upvotes: 3

Related Questions