Thanks for following up via the DTS channel, which reminded me to revisit this thread. To continue our discussion: I don't expect the document changes to be saved when the user intentionally kills the app That's great. I guess I was unclear how you quit the app (in your step 4). Thanks for your clarification. I would expect that when the app is quit normally via the main menu or keyboard shortcut Command-Q, the pending changes would be saved. Are such changes really intended to be discarded? The answer is no. When you app is quit in a managed way (CMD+Q, etc), AppKit automatically saves your pending changes if: autosavesInPlace returns true. (Otherwise, AppKit prompts the user as needed to choose a course of action.) You have marked the document dirty. Your code doesn't do step 2, and that's why your changes are lost. You can fix the issue by changing your code in the following way: // Conform to NSTextViewDelegate class Document: NSDocument, NSTextViewDelegate { ... override func makeWindowControlle
Topic:
UI Frameworks
SubTopic:
AppKit
Tags: