Issue #173
You might need to flip NSClipView
import AppKit
import Anchors
import Omnia
final class ScrollableStackView: NSView {
final class FlippedClipView: NSClipView {
override var isFlipped: Bool {
return true
}
}
override init(frame frameRect: NSRect) {
super.init(frame: frameRect)
setup()
}
required init?(coder decoder: NSCoder) {
fatalError()
}
let stackView: NSStackView = withObject(NSStackView()) {
$0.orientation = .vertical
}
private let scrollView: NSScrollView = NSScrollView()
private func setup() {
addSubview(scrollView)
scrollView.hasVerticalScroller = true
scrollView.drawsBackground = false
activate(
scrollView.anchor.edges
)
let clipView = FlippedClipView()
clipView.translatesAutoresizingMaskIntoConstraints = false
clipView.drawsBackground = false
scrollView.contentView = clipView
activate(
clipView.anchor.edges.equal.to(scrollView.anchor)
)
scrollView.documentView = stackView
stackView.translatesAutoresizingMaskIntoConstraints = false
activate(
clipView.anchor.left.top.right.equal.to(stackView.anchor)
)
}
}