osx - URL based document saving -
i have prototype project of url based documents, cache document info user defaults. user actions tally change count i'd autosave - once figure out how, explicit close triggers standard dialog save first.
choosing not save, window closes - first calling window's delegate, method - windowshouldclose, expected. choosing save, triggers call document's method
override func save(to url: url, oftype typename: string, saveoperation: nssaveoperationtype, completionhandler: @escaping (error?) -> void) { { try self.write(to: url, oftype: typename) swift.print("save(to: \(url.absolutestring) oftype: \(typename)) ") } catch let error { nsapp.presenterror(error) } }
which runs completion - debug output, ok suspect something's wrong window delegate method isn't called; 2nd try close window closes without incident.
i'm confused state not right change clearing didn't reset, allow doc close window after saving? btw not update change count.
Comments
Post a Comment