BottomSheet icon indicating copy to clipboard operation
BottomSheet copied to clipboard

Pass in item to ContentView

Open corysullivan opened this issue 3 years ago • 3 comments

When binding to an optional item. What are your thoughts on passing the item to the content view?

Similar to the sheet modifier.

func sheet<Item, Content>(item: Binding<Item?>, onDismiss: (() -> Void)? = nil, content: @escaping (Item) -> Content) -> some View where Item : Identifiable, Content : View

corysullivan avatar Aug 02 '21 14:08 corysullivan

It would be good to get this added but I had some issues only showing the sheet if the item could be unwrapped to return to the content view. You're welcome to have a go and open a PR :)

adamfootdev avatar Aug 15 '21 19:08 adamfootdev

I second this feature request; without it the repo doesn't work for me.

koedal avatar Oct 05 '21 18:10 koedal

I second this feature request; without it the repo doesn't work for me.

as a workaround until this is added:

.bottomSheet(item: $item) {
    item.flatMap { /* whatever view needed the unwrapped item */ }
}

But I also would love to see this implemented directly

tremblay avatar Jan 21 '22 00:01 tremblay