If !undo.undoing -- no explanation?

This book is starting to revert to the style of the older editions where you are told to copy and paste code without being given any explanation of how the code works. I thought we were going to do some hard work now so that in the next chapter we could see the Document architecture work as intended?

And, I’ll just add again: this book needs a competent editor. My gripe this time: pronouns have to be in close proximity to the nouns they refer to–there can’t be two or three other nouns between the pronoun and its corresponding noun.

I’m not considering giving up, but I agree that the quality of this chapter is far beneath that of the previous ones. The ideas don’t seem to be arranged in a logical sequence. In particular, about a third of the way down page 192, the books asks, “How do you get an undo manager?” Then comes the section “Key-Value Coding and To-Many Relationships” and then “Adding Undo to RaiseMan.” It’s hard to see how the first of these sections (a model of opacity, in my view) elucidates the second.

This chapter should be completely rewritten, I think.

As far as your comments on the grammar go, I don’t agree. Do you have an example?

I’ve been rewriting the text in my head, paragraph by paragraph.

Check out the last sentence on p. 196 that finishes on p. 197.

I found it surprising that !undo.undoing had no explanation.

As the name of the property is self-explanatory, the author may decide not to write too much on it.

func insertObject(_ employee: Employee, inEmployeesAtIndex index: Int) {
  . . .
  if !undo.isUndoing {
    undo.setActionName("Add Person")
  }

There are two cases the function insertObject(_:inEmployeesAtIndex:) is called.

  • One case in creating a new employee.
  • Another case in undo the deletion of an employee.

If the undoManager is not undoing (i.e. in first case), the menu will add the UNDO option “Add Person”.