I'm making an app that is modeled after the Sketch example program. I've rewritten Sketch in swift (it was a great way to learn the language) and everything works fine.
However, in this app, I want the document to be fixed size, different from the default size used by Sketch. So I set the size I want in Interface Builder on the Window and on the custom NSView within the ZoomingScrollView. I also set a fixed minimum and maximum on the Window to the same values and unchecked resizable.
The app opens with the window the correct size, but the document canvas is still the original size from the Sketch app. My window is wide and squat (landscape) and the document inside of it is tall (the vertical scroller is active) and narrow (there is a gray void area to the right of the document canvas).
I tried programmatically resizing the custom NSView but nothing happens. In fact, custom NSView is happily reporting that it's bounds and size are the fixed size that they should be.
override func awakeFromNib() {
var f = self.frame; // If you set a breakpoint here f reports as 568x320 anyway
f.size.width = 568;
f.size.height = 320;
self.frame = f;
self.setFrameSize(f.size)
self.setBoundsSize(f.size)
}
One hint, I think, is that the Sketch app itself does not change canvas when you try to resize it's window and if you change it's window and SKTGraphicView sizes in Interface Builder, you get the exact same behavior that I'm seeing.
I feel like I'm missing something very basic here!