NSUserDefaults [Int:Int]
load
if let data = NSUserDefaults.standardUserDefaults().objectForKey( "averagesPerLevel") as? NSData
{
let object = NSKeyedUnarchiver.unarchiveObjectWithData(data) as! [Int: Int]
print("average cached : \(object))")
}
save
NSUserDefaults.standardUserDefaults().setObject(NSKeyedArchiver.archivedDataWithRootObject(self.globalAverages!.averagesPerLevel), forKey:"averagesPerLevel")