diff --git a/iBox/Sources/BoxList/BoxListViewController.swift b/iBox/Sources/BoxList/BoxListViewController.swift index 147e668..5acb884 100644 --- a/iBox/Sources/BoxList/BoxListViewController.swift +++ b/iBox/Sources/BoxList/BoxListViewController.swift @@ -12,11 +12,10 @@ class BoxListViewController: BaseViewController, BaseViewController var shouldPresentModalAutomatically: Bool = false { didSet { if shouldPresentModalAutomatically { - // shouldPresentModalAutomatically가 true로 설정될 때 함수 호출 - if findAddBookmarkView() == nil { + if findAddBookmarkViewController() == false { + dismiss(animated: false) self.addButtonTapped() } - // 함수 호출 후 shouldPresentModalAutomatically를 false로 설정 shouldPresentModalAutomatically = false } } diff --git a/iBox/Sources/Extension/UIViewController+Extension.swift b/iBox/Sources/Extension/UIViewController+Extension.swift index 5277a9d..51b6343 100644 --- a/iBox/Sources/Extension/UIViewController+Extension.swift +++ b/iBox/Sources/Extension/UIViewController+Extension.swift @@ -19,16 +19,11 @@ extension UIViewController { return nil } - func findAddBookmarkView() -> Bool? { - var responder: UIResponder? = self - while let nextResponder = responder?.next { - if let viewController = nextResponder as? AddBookmarkView { - return true - } - responder = nextResponder + func findAddBookmarkViewController() -> Bool { + if let navigationController = presentedViewController as? UINavigationController, + let _ = navigationController.topViewController as? AddBookmarkViewController { + return true } - return nil + return false } - - }