BottomSheet icon indicating copy to clipboard operation
BottomSheet copied to clipboard

Feature request: Set preferredContentSize

Open benubois opened this issue 3 years ago • 1 comments

Hi, thanks for making this!

I was watching the WWDC sheets session and at around the 9:15 mark, Russell mentions that the sheet should respect a preferredContentSize if widthFollowsPreferredContentSizeWhenEdgeAttached = true.

I was wondering if it would be possible to automatically set preferredContentSize in this component to something like view.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize) so that the sheet only takes up the width of the contentView?

Or alternatively provide a way to set a preferredContentSize?

I failed to get this to work, but I was hoping you would know how to do it.

Here's the example from the session:

Before:

large

After:

small

benubois avatar Jun 25 '21 10:06 benubois

Thanks for the suggestion. After spending some time looking into it, SwiftUI doesn't appear to work very well with preferredContentSize and have seen others file feedback for similar issues. I'll keep looking into it to see if I can find a solution.

adamfootdev avatar Jul 12 '21 08:07 adamfootdev