CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

SwipePopViewController 0.3.4

SwipePopViewController 0.3.4

Maintained by Thanapat Sorralump, Chalermpong Satayavibul, Chalermpong Satayavibul, Athipat Nampetch, Chainarhong.



  • By
  • chalermpong

SwipePopViewController

Test Version License Platform

Allows swipe back gesture to be started from anywhere on the screen (not only from the left edge)

Requirements

  • iOS 9+
  • Swift 5

Installation

pod 'SwipePopViewController'
github "ltman/SwipePopViewController"
dependencies: [
  .package(url: "https://github.com/ltman/SwipePopViewController")
]

Usage

For the UIViewController that you want to enable swipe back, just import the library and call addSwipePopGesture() in viewDidLoad.

import SwipePopViewController

class YourViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        addSwipePopGesture()
    }
}

Background

If you are using UINavigationController, you will be able to swipe back to pop the top view controller off the navigation stack by default.

However, there are 3 pain points we found with this default swipe back feature:

  1. iPhone screen is so big that my thumb can't reach the left edge of screen easily.
  2. Code will get complicated when you want to disable this swipe back on some specific UIViewController.
  3. Some app might experience a frame skipping at the beginning of swiping back. This frame skipping is occurred when UIViewController has too many task to do during viewWillAppear, viewWillDisappear.

License

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