Instead of
let path = dataFilePath()
if let data = try? Data(contentsOf: path) {
let unarchiver = NSKeyedUnarchiver(forReadingWith: data)
items = unarchiver.decodeObject(forKey: “ChecklistItems”)
unarchiver.finishDecoding()
}
why not just to use NSKeyedUnarchiver.unarchiveObjectWithFile(some_path) as? [ChecklistItem] in loading and NSKeyedArchiver.archiveRootObject(items, toFile: some_path) in saving accordingly?