mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-15 10:49:14 +01:00
32 lines
970 B
Swift
32 lines
970 B
Swift
//
|
|
// PoppableGestureRecognizerDelegate.swift
|
|
// NetNewsWire-iOS
|
|
//
|
|
// Created by Maurice Parker on 11/18/19.
|
|
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
//
|
|
// https://stackoverflow.com/a/41248703
|
|
|
|
import UIKit
|
|
|
|
final class PoppableGestureRecognizerDelegate: NSObject, UIGestureRecognizerDelegate {
|
|
|
|
weak var navigationController: UINavigationController?
|
|
|
|
func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
|
|
return navigationController?.viewControllers.count ?? 0 > 1
|
|
}
|
|
|
|
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
|
return true
|
|
}
|
|
|
|
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldBeRequiredToFailBy otherGestureRecognizer: UIGestureRecognizer) -> Bool {
|
|
if otherGestureRecognizer is UIPanGestureRecognizer {
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
}
|