Reputation: 3092
In a document based macOS project I would like to avoid the
"Do you want to save the changes you made in the document “Untitled”? "Your changes will be lost if you don’t save them."
message.
I'm traying to implement this solution Preventing the "Save on Exit" dialogue on exit of a Cocoa Document Application
import Cocoa
class Document: NSDocument {
var myDoc = MyDoc()
func isDocumentEdited() -> Bool {
return false
}
}
but I get the error:
Method 'isDocumentEdited()' with Objective-C selector 'isDocumentEdited' conflicts with getter for 'documentEdited' from superclass 'NSDocument' with the same Objective-C selector
What could I do to resolve this error?
Upvotes: 1
Views: 591
Reputation: 47169
Unless you are calling isDocumentEdited
from a window class then you'll probably want to do:
class Document: NSDocument {
var myDoc = MyDoc()
override var isDocumentEdited: Bool {
return false
}
}
Upvotes: 1