horitaku46 / BlowinSwiper

BlowinSwiper makes it possible to swipe back from anywhere on the screen.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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! πŸŽ‰








Translation

Mr. Gargo translated this README into Russian!πŸ™‡β€β™‚οΈ

Requirements

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

Installation

CocoaPods

pod 'BlowinSwiper'

Carthage

github "horitaku46/BlowinSwiper"

Usage

See Example, for more details.

Normal

γ€ŠοΌ‘γ€‹ 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
    }
}

γ€ŠοΌ’γ€‹ 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

γ€ŠοΌ‘γ€‹ Please do γ€ŠοΌ‘γ€‹ of Normal.
γ€ŠοΌ’γ€‹ 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.

About

BlowinSwiper makes it possible to swipe back from anywhere on the screen.

License:MIT License


Languages

Language:Swift 98.0%Language:Ruby 1.3%Language:Objective-C 0.8%