I'm trying to implement the NSCoder, but am currently facing a stubborn issue. My goal is to save the array of strings via NSCoder to a local file and load it when the app opens next time.
Here is the class i've created, but i'm not sure how i should handle the init and encoder functions:
class MyObject: NSObject, NSCoding {
var storyPoints: [String] = []
init(storyPoints : [String]) {
self.storePoints = storePoints
}
required init(coder decoder: NSCoder) {
super.init()
???
}
func encodeWithCoder(coder: NSCoder) {
???
}
}
Moreover, how do i access it in my view controller? where should i declare a path for saving the NSCoder? It's not really clear enough.
Looking forward to any advices.
Thank you.