I hit an annoying auto-layout issue when working on a client project recently. I was attempting to upgrade the software from the 10.11 to the 10.12 SDK. We had a few compiler issues which were quickly resolved but when I ran the software the document view completely missing from its windows.

The view uses intrinsicContentSize to dynamically size itself inside an NSScrollView based on the document contents and zoom level. We also use a custom NSClipView subclass to centre the view when the scrollview is larger than it. This has worked fine for the last few years, however now my intrinsicContentSize override was not being called and the view was being positioned outside of the clipview bounds.

Continue reading