Error: Unable to Install Constraint on View—Swift 4.1

In Chapter 31, after updating ViewControl for Swift 4.1 and Xcode 9.4.1, I get a runtime error, which reads in part:

Unable to install constraint on view. Does the constraint reference something from outside the subtree of the view? That’s illegal.

No window appears. At the end of Chapter 30, ViewControl was working fine, so the problem must be in the NerdTabViewController file.

Has anyone encountered this? If so, have you found a way around it (in modern code)?

I found my error. It was in the class declaration in NerdTabViewController.swift. I incorrectly typed:

class NerdTabViewController: NSTabViewController {

I should have typed:

class NerdTabViewController: NSViewController {

Serendipity: if you haven’t used Xcode > Open Developer Tool > FileMerge, try it! It highlighted all the differences in my code (on the left) and the book author’s good, working code (on the right). I would never have found my mistake without this tool. And you don’t have to actually perform a merge—you can just use it for finding and viewing any differences between two files.

Thanks for the merge tip!