Swiftpack.co - Package - slackhq/PanModal
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

PanModal is an elegant and highly customizable presentation API for constructing bottom sheet modals on iOS.

Screenshot Preview

Platform: iOS 10.0+ Language: Swift 5 CocoaPods compatible Carthage compatible License: MIT


Read our blog on how Slack is getting more :thumbsup: with PanModal

Swift 4.2 support can be found on the Swift4.2 branch.


  • Supports any type of UIViewController
  • Seamless transition between modal and content
  • Maintains 60 fps performance


PanModal requires iOS 10+ and is compatible with Swift 4.2 projects.


pod 'PanModal'
github "slackhq/PanModal"
dependencies: [
  .package(url: "https://github.com/slackhq/PanModal.git", .exact("1.2.6")),


PanModal was designed to be used effortlessly. Simply call presentPanModal in the same way you would expect to present a UIViewController


The presented view controller must conform to PanModalPresentable to take advantage of the customizable options

extension YourViewController: PanModalPresentable {

    var panScrollable: UIScrollView? {
        return nil


If the presented view controller has an embedded UIScrollView e.g. as is the case with UITableViewController, panModal will seamlessly transition pan gestures between the modal and the scroll view

class TableViewController: UITableViewController, PanModalPresentable {

    var panScrollable: UIScrollView? {
        return tableView

Adjusting Heights

Height values of the panModal can be adjusted by overriding shortFormHeight or longFormHeight

var shortFormHeight: PanModalHeight {
    return .contentHeight(300)

var longFormHeight: PanModalHeight {
    return .maxHeightWithTopInset(40)

Updates at Runtime

Values are stored during presentation, so when adjusting at runtime you should call panModalSetNeedsLayoutUpdate()

func viewDidLoad() {
    hasLoaded = true

    panModalTransition(to: .shortForm)

var shortFormHeight: PanModalHeight {
    if hasLoaded {
        return .contentHeight(200)
    return .maxHeight

Sample App

Check out the Sample App for more complex configurations of PanModalPresentable, including navigation controllers and stacked modals.


Option + click on any of PanModal's methods or notes for detailed documentation.

Screenshot Preview


We're glad to be open sourcing this library. We use it in numerous places within the slack app and expect it to be easy to use as well as modify; we've added extensive documentation within the code to support that.

We will only be fixing critical bugs, thus, for any non-critical issues or feature requests we hope to be able to rely on the community using the library to add what they need. For more information, please read the contributing guidelines.


Stephen SowoleTosin Afolabi


PanModal is released under a MIT License. See LICENSE file for details.


Stars: 2772


Bug Fixes. - 2020-03-30T19:34:47

  • Track all dismiss events through panModalPresentable callbacks
  • Allow PanModal to be used in iOS Extensions.

SPM Support - 2019-11-11T18:52:53

Swift 5.0 Support! - 2019-11-11T18:27:19

Quarterly Update 1.2.4 - 2019-06-13T03:53:51

Fixes regression introduced to fix horizontal scrolling headers.

Quarterly Update 🍾 - 2019-06-08T20:58:44


  • Full Screen Sample App
  • Fix Horizontal Sliding Issue
  • Add configurable transitionDuration & transitionAnimationOptions
  • Remove dismissal during size class changes
  • Fix for frame recalculation when size class changes.

Podspec Update - 2019-04-02T14:17:49

Documentation Update & Renaming private methods. - 2019-04-02T14:16:51

Minor Improvements - 2019-03-20T21:09:53


  • Add Intrinsic Height to PanModalHeight
  • Add support for changing status bar appearance
  • Set Deployment Target to 10.0 for Carthage
  • Add configurable cornerRadius
  • Exclude Info.plist from Compile Sources
  • Better control over responding to the pan gesture in order to prevent the pan when needed.

Carthage Support 1.1 - 2019-03-14T17:39:59

Sets the Min Target of the Carthage Framework to 10.0

Carthage Support ! - 2019-03-13T23:02:37

Starting from the version, we now support Carthage!

Official Release 🎉 - 2019-03-13T22:06:19

Official Release of the Pan Modal Library from your friends @slackhq!