lucaszischka / BottomSheet

A sliding Sheet from the bottom of the Screen with 3 States build with SwiftUI.
MIT License
1.03k stars 138 forks source link

iPad Bottom Sheet, but at the Bottom ✨ #100

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hi!

I like this library, but it would be awesome if the bottom sheet could actually be at the bottom on an iPad. 😁

So... that's where this PR is for! I've also added a modifier that enables you to override the sheet width, and a modifier that adds bottom padding to the main content if the keyboard is opened (which should fix this issue I believe: #97 ).


iPad Demo

View's Code

VStack {
    Button("TESTING APP πŸ¦†") {}
}
.bottomSheet(
    bottomSheetPosition: $position,
    switchablePositions: [.dynamicBottom, .absolute(400), .absolute(600), .relativeTop(1)],
    headerContent: { Text("Bottom Sheet Title").font(.title.bold()) },
    mainContent: {
        VStack {
            Divider().padding()
            TextEditor(text: $loremIpsum)
        }
    }
)
.iPadFloatingSheet(false)
.relativeSheetWidth(1.0)
.accountForKeyboardHeight()

Without the keyboard auto adjust

https://user-images.githubusercontent.com/103025931/188599117-40a26131-a6cd-4855-9239-16ec7067b475.mp4

With the keyboard auto adjust

https://user-images.githubusercontent.com/103025931/188599133-7fcad1ac-8700-44e0-a646-267ebd207f51.mp4


I'm looking forward to your feedback! 😊

lucaszischka commented 2 years ago

Amazing pull request. First of all, thank you for your work! I will review it later today.

ghost commented 2 years ago

Ah, I see the issue that turned up in the CI, I'm currently fixing it!

lucaszischka commented 2 years ago

Amazing pull request. Mentioned a couple of thinks (most if it really small changes to so that you match my code style). πŸ₯³ Thank you for your clean contribution ❀️

lucaszischka commented 2 years ago

Oh and before I forget to mention it. Please also add your changes to the changelog and update the version in the podspec file accordingly.

Also if you have any questions regarding my review please ask.

ghost commented 2 years ago

Thanks for merging! 😊