BlowinSwiper 1.0.14

BlowinSwiper 1.0.14

Maintained by Takuma Horiuchi.



Platform Swift Cocoapods Carthage compatible License

Overview

BlowinSwiper makes it possible to swipe back from anywhere on the screen at UINavigationController!
I developed BlowinSwiper for handling with various gestures. But only right swipe...

Features

In this library, I considered what to do the handling of the horizontal scroll. It is like a search screen on Twitter Client App.
It is the screen on the right. Sample is thinking about handling with SwipeMenuViewController.

  • Support iPhone, iPad and iPhone X! 🎉








Requirements

  • Xcode 9.0+
  • iOS 10+
  • Swift 4.0+

Installation

CocoaPods

pod 'BlowinSwiper'

Carthage

github "horitaku46/BlowinSwiper"

Usage

See Example, for more details.

Normal

《1》 Please add UIGestureRecognizerDelegate to UINavigationController. Because to enable edge swipe back.

import UIKit

final class NavigationController: UINavigationController {
    override func viewDidLoad() {
        super.viewDidLoad()
        interactivePopGestureRecognizer?.delegate = self
    }
}

extension NavigationController: UIGestureRecognizerDelegate {
    func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer,
                           shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
        return true
    }
}

《2》 Please set BlowinSwipeable to UIViewController, and set configureSwipeBack() to viewDidAppear.

import UIKit

final class ViewController: UIViewController, BlowinSwipeable {

    var blowinSwiper: BlowinSwiper?

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        configureSwipeBack()
    }
}

Horizontal scroll handling

《1》 Please do 《1》 of Normal.
《2》 Please refer to the following source code.
Set BlowinSwipeable to UIViewController.
Set configureSwipeBack(isLowSensitivity: true) and enabledRecognizeSimultaneously(scrollView: swipeMenuView.contentScrollView) to viewDidAppear.
Set disabledRecognizeSimultaneously() to viewDidDisappear.

import UIKit

final class ViewController: UIViewController, BlowinSwipeable {

    var blowinSwiper: BlowinSwiper?

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        configureSwipeBack(isInsensitive: true)
        enabledRecognizeSimultaneously(scrollView: swipeMenuView.contentScrollView)
    }

    override func viewDidDisappear(_ animated: Bool) {
        super.viewDidDisappear(animated)
        disabledRecognizeSimultaneously()
    }
}

extension MenuViewController: SwipeMenuViewDelegate {
    func swipeMenuViewDidScroll(_ contentScrollView: UIScrollView) { // added itself to this delegate.
        handleScrollRecognizeSimultaneously(scrollView: contentScrollView)
    }
}

Author

Takuma Horiuchi

License

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