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...
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! 🎉
Mr. Gargo translated this README into Russian!🙇♂️
- Xcode 9.0+
- iOS 10+
- Swift 4.0+
pod 'BlowinSwiper'
github "horitaku46/BlowinSwiper"
See Example, for more details.
《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()
}
}
《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)
}
}
BlowinSwiper
is available under the MIT license. See the LICENSE file for more info.