I have implemented a custom Layout
, specifically a label view that hides any trailing views that are clipped.
Now in my placeSubviews()
method - even if I don't explicitly place a view - SwiftUI will layout the view and show it.
As there seems to be no way to hide a LayoutSubview
, I have resorted to placing the view somewhere very far off screen like this
let maxOffset = CGFloat.greatestFiniteMagnitude
let offScreen = CGPoint(x: maxOffset, y: maxOffset)
subview.place(at: offScreen, proposal: .unspecified)
but I don't really like this solution.
Is there an official Apple "sanctioned" way how to hide LayoutSubview
s inside a Layout
?