I would like to determine the instrinstic size of a stack view before displaying it on the screen. The idea is to use it as part of a pull up menu from the bottom of the screen but when I query the object before it appears it has size (-1,-1). Is there anything I should do first before my call to instrinsic content size?
UIStackView
has no intrinsic content size. You're getting -1 because that is the value of UIView.noIntrinsicMetric
.
Instead, ask for its fitting size:
let size = stackView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize)