2019-11-19 02:12:24 +01:00
|
|
|
//
|
|
|
|
// PoppableGestureRecognizerDelegate.swift
|
|
|
|
// NetNewsWire-iOS
|
|
|
|
//
|
|
|
|
// Created by Maurice Parker on 11/18/19.
|
|
|
|
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
|
|
//
|
2020-04-06 15:47:01 +02:00
|
|
|
// https://stackoverflow.com/a/41248703
|
2019-11-19 02:12:24 +01:00
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
|
|
|
final class PoppableGestureRecognizerDelegate: NSObject, UIGestureRecognizerDelegate {
|
|
|
|
|
|
|
|
weak var navigationController: UINavigationController?
|
|
|
|
|
2020-04-06 15:47:01 +02:00
|
|
|
func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
|
|
|
|
return navigationController?.viewControllers.count ?? 0 > 1
|
2019-11-19 02:12:24 +01:00
|
|
|
}
|
|
|
|
|
2020-04-06 15:47:01 +02:00
|
|
|
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
2020-04-21 08:52:39 +02:00
|
|
|
return navigationController?.viewControllers.count ?? 0 > 2
|
2019-11-19 02:12:24 +01:00
|
|
|
}
|
2020-04-06 15:47:01 +02:00
|
|
|
|
2019-11-19 02:12:24 +01:00
|
|
|
}
|