import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let homeDicPath = NSHomeDirectory()
let filePath = homeDicPath+"archiver.file"
let mutableData = NSMutableData()
let archiver = NSKeyedArchiver(forWritingWith: mutableData)
archiver.encode(24, forKey: "age")
archiver.encode("jaki", forKey: "name")
archiver.finishEncoding()
mutableData.write(toFile: filePath, atomically: true)
}
}