What is the best way to save/load contents of arra

2019-08-11 10:54发布

I have a Swift application where I have an NSTableView populated by an array of custom structs, which contains an NSSound property. My question is, what is the best way to save the content of this array to a file, and how would I load the array from said file?

1条回答
▲ chillily
2楼-- · 2019-08-11 11:08

Save the content to a file with:

NSKeyedArchiver.archiveRootObject(rootObject: AnyObject, toFile: String)

Load the array with:

NSKeyedUnarchiver.unarchiveObjectWithFile(path: String)
查看更多
登录 后发表回答