Create pull up view with multiple sticky points with scrollView supported.
- Multiple sticky points
- Only Support's Portrait
- Support's scrollView scroll connection (like AirBnb)
TWPullUpView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'TWPullUpView'
override func viewDidLoad() {
super.viewDidLoad()
let pullUpView = MyPullUpView()
pullUpView.addOn(view, initialStickyPoint: .percent(0.3), animated: true)
}
class MyPullUpView: TWPullUpView {
}
// It get called before the view move to nearest sticky point
view.willMoveToPoint = { point in
}
// It get called after the view moved to the nearest sticky point
didMoveToPoint = { point in
}
// It get called when the user is panning the view
didChangePoint = { point in
}
class MyPullUpView: TWPullUpView {
private func setOptions() {
addScrollView(tableView)
}
}
struct TWCustomOptions: TWOptionProtocol {
var animationDuration: Double = 0.3
var animationDamping: CGFloat = 1
var animationSpringVelocity: CGFloat = 0.4
var overMaxHeight: Bool = true
var underMinHeight: Bool = true
}
private let customOptions: TWOptionProtocol = TWCustomOptions()
private func setOptions() {
stickyPoints = [.percent(0.3), .percent(0.6), .max]
setOption(customOptions)
addScrollView(tableView)
}
To run the example project, clone the repo, and run pod install
from the Example directory first.
TWPullUpView is available under the MIT license. See the LICENSE file for more info.