I'm writing a Cocoa Document based app.
I've gotten it to the point where it can save a document using
override func data(ofType typeName: String) throws -> Data {
// End editing
let jsonEncoder = JSONEncoder()
let jsonData = try jsonEncoder.encode(self)
let jsonString = String(data: jsonData, encoding: .utf8)
Swift.print(jsonString)
return jsonData
}
I've got a corresponding read method
override func read(from data: Data, ofType typeName: String) throws {
let jsonDecoder = JSONDecoder()
let rep = try jsonDecoder.decode(Document.self, from: data) as! Document
videoURL = rep.videoURL
timestamps = rep.timestamps
}
But it never seems to get called. If I start the app and use the open menu item, I'd expect the read method to be called after I select the file to open, but instead it just opens a window with a new document.
I'm stumped. I've got a hunch it might have something to do with the info.plist, or the entitlements file, but I can't understand what.
I'd appreciate any help or ideas.