Created
August 22, 2022 20:41
-
-
Save circAssimilate/040a157327a8f20485bb04247f5dfb96 to your computer and use it in GitHub Desktop.
Adapted from https://stackoverflow.com/a/14572970.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NSScrollView { | |
var documentSize: NSSize { | |
set { documentView?.setFrameSize(newValue) } | |
get { documentView?.frame.size ?? NSSize.zero } | |
} | |
var documentOffset: NSPoint { | |
set { documentView?.scroll(newValue) } | |
get { documentVisibleRect.origin } | |
} | |
var isScrolledToEnd: Bool { | |
self.frame.height - (self.documentSize.height - self.documentOffset.y) == 0 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment