Does anyone know the correct way to scroll the NSScrollView to the top? I was looking for an equivalent to the UIView's scrollToTop method.
This is what I have so far, but its not quite right under all situations
[self.contentView scrollToPoint:NSMakePoint(0, MAX(contentView.frameHeight, ((NSView*)self.documentView).frameHeight))];
This also works fine. Set scroll point of documentView of NSScrollView
The previous solutions scroll to the bottom when translating to Swift for Mac OS. The y coordinate direction is flipped on Mac OS and iOS.
Swift 3 Solution for Mac OS:
Updated for Swift 4:
If your document view is flipped:
otherwise:
Finally figured it out. Works like a charm!