QuickSheet
What is it?
QuickSheet is a wrapper for UIViewController to handle bottom sheet presentation (a.k.a pop-ups) with low code footprint and a high degree of customisation.
Why do you need it?
Bottom Sheet / Pop-up view presentation in iOS is only available (natively) in iOS 15 with limited functionality that’s only expanded upon in iOS 16. Attempting to replicate the effect in prior versions of iOS could include adding multiple modifications to how you build your views and view controllers that might make it more difficult to migrate to the native soultion when it hits the mainstream especially in large scale applications.
Usage
You can present the target view controller without any modifications to it by calling self.presentQuickSheet
method with the standard options
self.presentQuickSheet(targetVC, options: .standard)
Customisations
You can customise the presentation by creating a new options constant
let customOptions = QuickSheetOptions(fraction: 0.3,
isExpandable: true,
isScrollable: true,
cornerRadius: 10,
blurEffect: .systemMaterial,
shadowStyle: .standard)
self.presentQuickSheet(targetVC, options: customOptions)
Here’s how you can use QuickSheetOptions
to customise your pop-up
fraction
: Represents the height of the sheet as a percentage of the screen heightisExpandable
: Setting this option totrue
enables the pop-up to expand to a near full heightisScrollable
: Setting this option totrue
enables scrolling in the content viewcornerRadius
: Changing this value determines the radius of the top left and right cornersblurEffect
: Choose a background effect from a system-defined listUIBlurEffect.Style
shadowStyle
: Determines the shadow style of the pop-up. Set to.standard
to use the default configuration or create your ownQuickSheetOptions.ShadowStyle
constant as follows
let shadowStyle = QuickSheetOptions.ShadowStyle(shadowRadius: 10.0,
shadowColor: .black,
shadowOpacity: 0.25)
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Installation
QuickSheet is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'QuickSheet'
Author
Ahmed Fathy, [email protected]
License
QuickSheet is available under the MIT license. See the LICENSE file for more info.