Error overriding Superclass function in Listing 26.8


The code
override class func autosavesInPlace() -> Bool {
return true
generates error “Method does not override any method from its superclass”. and build fails.

What am I missing here?


According to the documentation, autosavesInPlace is a class var not a func.


Thanks. Yes, I saw that in the documentation. But, I was following the “Listing 26.8 Clearing the decks (Document.swift)” in the book “Swift Programming 2nd Edition The Big Nerd Ranch Guide” by Mathew Mathias and John Gallagher.