Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion iBox/Sources/Base/BaseViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protocol BaseViewControllerProtocol {
func setupNavigationBar()
}

class BaseViewController<View: UIView>: UIViewController {
class BaseViewController<View: UIView>: UIViewController, UIGestureRecognizerDelegate {

let backgroundColor: UIColor = .backgroundColor
let tintColor: UIColor = .label
Expand Down Expand Up @@ -62,6 +62,7 @@ class BaseViewController<View: UIView>: UIViewController {
private func setupProperty() {
view.backgroundColor = .backgroundColor
navigationController?.setNavigationBarHidden(true, animated: false)
navigationController?.interactivePopGestureRecognizer?.delegate = self

setNavigationBarTintColor(tintColor)
setNavigationBarTitleLabelFont(titleFont)
Expand Down Expand Up @@ -226,4 +227,12 @@ class BaseViewController<View: UIView>: UIViewController {
navigationController?.popViewController(animated: true)
}

// MARK: - UIGestureRecognizerDelegate

func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
guard let navigationController = navigationController else { return false }
// Navigation Stack에 쌓인 뷰가 1개를 초과할 때 스와이프 제스처 허용
return navigationController.viewControllers.count > 1
}

}