Giter Club home page Giter Club logo

twpullupview's Introduction

TWPullUpView

Create pull up view with multiple sticky points with scrollView supported.

Platform Swift 5 Version License

Features

  • Multiple sticky points
  • Only Support's Portrait
  • Support's scrollView scroll connection (like AirBnb)

Installation

TWPullUpView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'TWPullUpView'

Usage example

override func viewDidLoad() {
    super.viewDidLoad()
    let pullUpView = MyPullUpView()
    pullUpView.addOn(view, initialStickyPoint: .percent(0.3), animated: true)
}


class MyPullUpView: TWPullUpView {

}

Callback

// 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

}

Usage for internal scrollView

class MyPullUpView: TWPullUpView {

  private func setOptions() {
      addScrollView(tableView)
  }
}

Set Custom Options

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)
 }

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

License

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

twpullupview's People

Contributors

topwiz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.