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)
// ...
}