In a macOS project I use autosavesInPlace in this way:
import Cocoa
class Document: NSDocument {
override class func autosavesInPlace() -> Bool {
return true
}
}
This worked until the project was in Swift 3.2 but when updating the project in Swift 4, I get this error:
Method does not override any method from its superclass
How can I fix this?
Since Swift 4 autosavesInPlace
is a property (not a function), so you should override in this way:
class Document: NSDocument {
override class var autosavesInPlace: Bool {
return true
}
}