var objects: AnyObject? = NSKeyedUnarchiver.unarchiveObjectWithData(data)
How to turn objects into NSMutableArray ? I archived NSMutableArray.
Just downcast the result to NSMutableArray:
if let objects = NSKeyedUnarchiver.unarchiveObjectWithData(data) as? NSMutableArray {
// ...
} else {
// failed
}
If the archived object is an (immutable) NSArray then you have to create a mutable
copy:
if let array = NSKeyedUnarchiver.unarchiveObjectWithData(data) as? NSArray {
let objects = NSMutableArray(array: array)
// ...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With