SwiftySlideUpController is a Swift lightweight library to add a slide up controller with interactive animations easily
To install SwiftySlideUpController with CocoaPods, add this to your Podfile
:
pod 'SwiftySlideUpController'
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.
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)
The example project shows how to create a SlideUpController using custom objects and handling different orientations.
SwiftySlideUpController is available under the MIT license. See LICENSE file for more info.