Skip to content

If you cannot find BottomSheetView #40

@burakalemun

Description

@burakalemun

If you're coming from "DesignCode" videos, you may not have been able to find BottomSheetView due to the old version. With the new version, if you make the following adjustments, you will achieve the desired result.

All you need to do is:

@State var isBottomSheetPresented = true
@State var selectedDetent: BottomSheet.PresentationDetent = .medium

EmptyView()
    .sheetPlus(
        isPresented: $isBottomSheetPresented,
        background: (
            ForecastView()
        ),
        main: {
            EmptyView()
                .presentationDetentsPlus(
                    [.height(0),  .medium, .large],
                    selection: $selectedDetent
                )
        }
    )

isBottomSheetPresented determines whether the Bottom Sheet is open or closed, while selectedDetent allows us to control its size. With the code written in [.height(0), .medium, .large], we can open it to medium height, enlarge it to large, or completely close it thanks to .height(0).

Ekran Resmi 2024-10-02 03 25 29

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions