⬆️ A SwiftUI view component sliding in from bottom

Overview

SwiftUI BottomSheet

GitHub tag (latest SemVer) License

preview preview

Requirements

iOS 13+

Swift 5.0

Usage

Same way as you use Sheet in SwiftUI

NavigationView {
    List(0..<20) {
        Text("\($0)")
    }.listStyle(PlainListStyle())
    .bottomSheet(isPresented: $isPresented, height: 300) {
        List(20..<40) { Text("\($0)") }.listStyle(PlainListStyle())
    }
    .navigationBarTitle("Bottom Sheet")
    .navigationBarItems(
        trailing: Button(action: { self.isPresented = true }) {
            Text("Show")
        }
    )
}

Example

Both demo preview code are available in example project.

To run the example project, clone this repo, and open iOS Example.xcworkspace from the iOS Example directory.

Installation

Swift Package Manager

To install BottomSheet using Swift Package Manager, add .package(name: "BottomSheet", url: "https://github.com/weitieda/bottom-sheet", from: "1.0.0")," to your Package.swift, then follow the integration tutorial here.

CocoaPods

To install BottomSheet using CocoaPods, add pod 'BottomSheet', :git => 'https://github.com/weitieda/bottom-sheet.git' to your Podfile, then follow the integration tutorial here.

Author

Tieda Wei

License

BottomSheet is available under the MIT license. See the LICENSE file for more information.

Comments
  • Flicker when using bottom sheet starting with isPresented == false

    Flicker when using bottom sheet starting with isPresented == false

    The way to reproduce is to put a simple Rectangle in the BottomSheet and start with isPresented = false. While the GeometryReader is loading, the offset is incorrect and creates a flicker.

    opened by joncottrell 5
  • Layout with Margin after add Bottom Sheet

    Layout with Margin after add Bottom Sheet

    Hello authors,

    I have a simple cart list. After add Bottom sheet to my project, I have unespected margin:

    https://user-images.githubusercontent.com/7614148/109086117-bde08e80-76e9-11eb-9460-9281139417e4.png

    Before add BottomSheet:

    https://user-images.githubusercontent.com/7614148/109086184-e49ec500-76e9-11eb-8e2f-96dd4b1446cf.png

    CartView source code: https://gist.github.com/MarcusAdriano/9affed479cd7b47cbedb5d9d940628aa

    opened by MarcusAdriano 4
  • 🐛 Use EmptyView when geometry reader is still sized at 0

    🐛 Use EmptyView when geometry reader is still sized at 0

    I can't think of any instance where the geometry reader has a size of 0 where we would want to display the bottom sheet. I have tested this in my own app and it appears to work quite well. This fixes "flickering" when using bottom sheet anywhere that is not a top-level view.

    opened by joncottrell 3
  • Broken 1.0.9

    Broken 1.0.9

    Here the param geometry in: should be just geometry: https://github.com/weitieda/bottom-sheet/blob/72b1809abaf0c7697f4f3633c619c3f7ceda3415/Sources/BottomSheet/BottomSheet.swift#L73

    opened by illabo 3
  • Unable to mimic .sheet usage for project.

    Unable to mimic .sheet usage for project.

    Forgive me please, as this is my first attempt at an issue and I'm new to programming. I am trying to utilize your wonderful SPM project in my own application.

    @State var presentedLocation: Location?
               
     .sheet(item: $presentedLocation) { place in
        SelectedBusinessSheet(selectedBusiness: place)
    }
    

    Above is how I would call this sheet and display the data. the presentedLocation is an identifiable struct that is used to create an array of data. This method displays the sheet as desired but it looks poorly and would look better in a BottomSheet.

    I am unable to mimic this method however, as displayed below, I get the following errors.

    .bottomSheet(isPresented: $presentedLocation, height: 700, content: { place in
       SelectedBusinessSheet(selectedBusiness: place)
    })
    
    
    • Cannot convert value of type 'Binding<Location?>' to expected argument type 'Binding'
    • Contextual closure type '() -> SelectedBusinessSheet' expects 0 arguments, but 1 was used in closure body

    I apologize if these are obvious errors that can be easily rectified. Any help is appreciated!

    opened by haIIux 3
  • Pod spec dependency on this package

    Pod spec dependency on this package

    Hello. I am in the process of publishing a framework to cocoa pods. I have two dependencies, this package and kingfisher. I am able to add the dependency to kingfisher no problem in the podspec file. But this package seems to be have it specs hosted in a private repository. I am not able to use it as a dependency. I was wondering if anyone knew the url that the spec is hosted at or if anyone knew how i could handle this.

    Thank you very much!

    opened by jimdog1001 1
  • add onDismiss to control user interfaces

    add onDismiss to control user interfaces

    I think that some actions are needed when bottom sheet is closed. it is little tricky to dismiss the keyboard to TextField on iOS 14, so I added escaping function. Please consider it for the next version! Thank you so much for your library.

    opened by jkimdev 1
  • Fix home gesture collision

    Fix home gesture collision

    The home-gesture on iOS devices without a physical home button can collide with the DragGesture that is attached to the bottom sheet. The gesture allows to hide the presented bottom sheet by dragging the top bar down to the edge of the screen.

    However, when swiping up from the bottom to send the app to the background, the gesture still receives changes. When the bottom sheet is hidden, this can lead to a miscalculation of the sheet position. See the attached video:

    BackgroundProblem

    The fix is to ignore the swipe-up gesture when the bottom sheet is hidden.

    opened by melle 1
  • Change listStyle on examples to PlainListStyle

    Change listStyle on examples to PlainListStyle

    News

    Lists used on example (iOS Example) has some unespected padding (iOS 14+):

    Current issue open: #5

    image image

    Padding was removed using: .listStyle(PlainListStyle())

    After code fix:

    image

    opened by MarcusAdriano 1
  • Add ability to customize top bar corner radius and top bar height

    Add ability to customize top bar corner radius and top bar height

    Now we can customize top bar corner radius and top bar height using topBarCornerRadius and topBarHeight parameter.

    topBarHeight / 3 is used as top bar corner radius like before unless topBarCornerRadius parameter is given.

    30 is used as top bar height like before unless topBarHeight parameter is given.

    Screenshot: top bar corner radius to 16pt, top bar height to 16pt image

    opened by getogrand 1
  • Create bottom sheet with item binding

    Create bottom sheet with item binding

    This PR fixes https://github.com/weitieda/bottom-sheet/issues/13.

    With this PR, it is now possible to show/hide the Botton sheet based on an item being nil or not.

    @State var presentedLocation: Location?
    
    .bottomSheet(item: $presentedLocation, height: 700) { place in
       SelectedBusinessSheet(selectedBusiness: place)
    }
    

    This is similar to https://developer.apple.com/documentation/swiftui/form/sheet(item:ondismiss:content:)

    opened by 4brunu 0
  • horizontal scrollView as content doesn't work

    horizontal scrollView as content doesn't work

    When my horizontal scrollView is longer than the bottomSheet width, we didn't see extra items: https://user-images.githubusercontent.com/29228517/121769865-47677f80-cb66-11eb-87a9-0962f55db6d8.mp4

    opened by blandinf 0
  • Add ability to customize Bottom Sheet opening and closing animation

    Add ability to customize Bottom Sheet opening and closing animation

    Can now customize the animation of the BottomSheet View opening and closing by adding the optional animation parameter. When deciding not to provide the animation parameter the default animation is continued left as .interactiveSpring() otherwise it requires an Animation modifier.

    Example Video: the custom animation added to Map Settings is set to Animation.spring(response: 0.5, dampingFraction: 2.0, blendDuration: 1.0)

    https://user-images.githubusercontent.com/36911172/115977902-0ed5fd00-a54a-11eb-99dc-48a7f33e4f93.mov

    opened by myronjwells 1
  • Dragging inner scroll

    Dragging inner scroll

    Hey, is there a way to move the outer view by dragging only the inner scroll? (like in Apple Maps app, Find My by Apple, Google Maps)

    for example UIKit solutions: UBottomSheet - https://github.com/OfTheWolf/UBottomSheet ClassPass app - https://medium.com/classpass-engineering/creating-a-fluid-scroll-experience-on-ios-faeb29be3bdb

    opened by Thongvor 0
  • Keyboard overlaps bottomSheet

    Keyboard overlaps bottomSheet

    Thanks for creating this library

    I am trying to use TextEditor inside .bottomSheet. UI works as expected bottomSheet

    However, as soon as I tap inside TextEditor, keyboard pops up and covers the bottom sheet bottomSheet_keyboard

    What can be done to readjust the bottom sheet?

    opened by prabh-62 6
Releases(1.0.12)
Owner
Tieda
Curious of unknown
Tieda
A stepper with a sliding label in the middle.

GMStepper A stepper with a sliding label in the middle. Pan the label or tap the buttons. Check out the tutorial, How to Build a Custom Stepper - Part

Günay Mert Karadoğan 916 Dec 18, 2022
SwiftUI-Drawer - A bottom-up drawer in swiftUI

SwiftUI-Drawer A bottom-up drawer view. Contents Installation Examples Installat

Bruno Wide 9 Dec 29, 2022
A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize.

SwiftUI Drawer A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize. Contents Add the Package Basic Usage Examples Credits

Michael Verges 695 Jan 3, 2023
BulletinBoard is an iOS library that generates and manages contextual cards displayed at the bottom of the screen

BulletinBoard is an iOS library that generates and manages contextual cards displayed at the bottom of the screen. It is especially well

Alexis (Aubry) Akers 5.3k Jan 2, 2023
Zeplin component preview for your SwiftUI views

A Zeplin component preview for your SwiftUI views. You can use Zeplin components instead of real views within your app until you implement them.

Danis Tazetdinov 4 Sep 1, 2022
A multi-platform SwiftUI component for tabular data

SwiftTabler A multi-platform SwiftUI component for tabular data. NOTE this component is BRAND NEW and under active development. If you need stability,

OpenAlloc 45 Jan 3, 2023
AGCircularPicker is helpful component for creating a controller aimed to manage any calculated parameter

We are pleased to offer you our new free lightweight plugin named AGCircularPicker. AGCircularPicker is helpful for creating a controller aimed to man

Agilie Team 617 Dec 19, 2022
UI Component. This is a copy swipe-panel from app: Apple Maps, Stocks. Swift version

ContainerController UI Component. This is a copy swipe-panel from app: https://www.apple.com/ios/maps/ Preview Requirements Installation CocoaPods Swi

Rustam 419 Dec 12, 2022
An easy to use UI component to help display a signal bar with an added customizable fill animation

TZSignalStrengthView for iOS Introduction TZSignalStrengthView is an easy to use UI component to help display a signal bar with an added customizable

TrianglZ LLC 22 May 14, 2022
UIPheonix is a super easy, flexible, dynamic and highly scalable UI framework + concept for building reusable component/control-driven apps for macOS, iOS and tvOS

UIPheonix is a super easy, flexible, dynamic and highly scalable UI framework + concept for building reusable component/control-driven apps for macOS, iOS and tvOS

Mohsan Khan 29 Sep 9, 2022
A panel component similar to the iOS Airpod battery panel or the Share Wi-Fi password panel.

A SwiftUI panel component similar to the iOS Airpod battery panel or the Share Wi-Fi password panel.

Red Davis 12 Feb 7, 2022
Customizable CheckBox / RadioButton component for iOS

GDCheckbox An easy to use CheckBox/Radio button component for iOS, with Attributes inspector support. Requirements Xcode 10+ Swift 5 iOS 9+ Installati

Saeid 23 Oct 8, 2022
TSnackBarView is a simple and flexible UI component fully written in Swift

TSnackBarView is a simple and flexible UI component fully written in Swift. TSnackBarView helps you to show snackbar easily with 3 styles: normal, successful and error

Nguyen Duc Thinh 3 Aug 22, 2022
TDetailBoxView is a simple and flexible UI component fully written in Swift

TDetailBoxView is a simple and flexible UI component fully written in Swift. TDetailBoxView is developed to help users quickly display the detail screen without having to develop from scratch.

Nguyen Duc Thinh 2 Aug 18, 2022
TSwitchLabel is a simple and flexible UI component fully written in Swift.

TSwitchLabel is a simple and flexible UI component fully written in Swift. TSwitchLabel is developed for you to easily use when you need to design a UI with Label and Switch in the fastest way without having to spend time on develop from scratch.

Nguyen Duc Thinh 2 Aug 18, 2022
A paging scroll view for SwiftUI, using internal SwiftUI components

PagingView A paging scroll view for SwiftUI, using internal SwiftUI components. This is basically the same as TabView in the paging mode with the inde

Eric Lewis 18 Dec 25, 2022
SwiftUI-Margin adds a margin() viewModifier to a SwiftUI view.

SwiftUI-Margin adds a margin() viewModifier to a SwiftUI view. You will be able to layout the margins in a CSS/Flutter-like.

Masaaki Kakimoto(柿本匡章) 2 Jul 14, 2022
A way to quickly add a notification badge icon to any view. Make any view of a full-fledged animated notification center.

BadgeHub A way to quickly add a notification badge icon to any view. Demo/Example For demo: $ pod try BadgeHub To run the example project, clone the r

Jogendra 772 Dec 28, 2022