Skip to content

SwiftySlideUpController is a Swift lightweight library to add a slide up controller with interactive animations easily

License

Notifications You must be signed in to change notification settings

DavidMorenoDWeb/SwiftySlideUpController

Repository files navigation

SwiftySlideUpController

CocoaPods Platform Swift 5.0 License

SwiftySlideUpController is a Swift lightweight library to add a slide up controller with interactive animations easily

Installation

CocoaPods

To install SwiftySlideUpController with CocoaPods, add this to your Podfile:

pod 'SwiftySlideUpController'

Manual installation

To add SwiftySlideUpController to your app manually, clone this repo and place it somewhere on disk, then add SwiftySlideUpController.xcodeproj to the project and add SwiftySlideUpController.framework as an embedded app binary and target dependency.

Basic example

You can add a SlideUpController to your UIViewController and add your items to it easily.

// Creates the SlideUpController
var slideUpController: SlideUpControllerDefault = SlideUpControllerModule().buildDefault()
        
// Presents it in your current UIViewController        
slideUpController.present(in: self)

// Sets the header title
slideUpController.set(headerTitle: "Comments")

// Adds a couple of items
slideUpController.addItem(SlideUpControllerItem(data: SlideUpControllerItemData(title: "Your cool title", text: "The description text", image: nil), value: index, handler: { item in
                // Item click handler
                print("Item tapped with name: \(String(describing: item.data.title))")
            }))
            
slideUpController.addItem(SlideUpControllerItem(data: SlideUpControllerItemData(title: "Your second item title", text: "The description text", image: nil), value: index, handler: { item in
                // Item click handler
                print("Item tapped with name: \(String(describing: item.data.title))")
            }))

You can pass an UIImage to each item initializer as well in order to show the image in the cell.

You can change the header title color too:

slideUpController.set(mainColor: UIColor.blue)

Or the controller height, which can be useful to work with different orientations:

slideUpController.set(controllerHeight: 500)

Example project

The example project shows how to create a SlideUpController using custom objects and handling different orientations.

License

SwiftySlideUpController is available under the MIT license. See LICENSE file for more info.

About

SwiftySlideUpController is a Swift lightweight library to add a slide up controller with interactive animations easily

Resources

License

Stars

Watchers

Forks

Packages

No packages published