[Fix] BaseViewController TabBar Hidden 조건 추가#89
Conversation
개요기본 뷰 컨트롤러에서 네트워크 오류 플래그를 탭 바 표시 여부 플래그로 교체했습니다. 추천 루틴 결과 뷰 컨트롤러에서 탭 바 가시성을 false로 재정의합니다. 변경 사항
코드 리뷰 예상 수준🎯 2 (Simple) | ⏱️ ~8분 축하 시
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Projects/Presentation/Sources/Common/Protocol/BaseViewController.swift (1)
24-28:⚠️ Potential issue | 🟠 Major탭 바 복원 여부는
isShowingTabBar가 아니라 “이 클래스가 직접 숨겼는지”로 추적하는 편이 안전합니다.
isShowingNetworkError를 제거하면서deinit가 이제isShowingTabBar == true인 화면에서 항상 탭 바를 다시 보이게 됩니다. 이렇게 되면 이 화면이 탭 바를 숨긴 적이 없어도 다른 전환이나 컨테이너가 숨긴 상태를 덮어써서, 네트워크 에러와 무관한 플로우에서도 탭 바가 갑자기 나타나는 회귀가 생길 수 있습니다.BaseViewController가 직접 숨긴 경우만 별도 플래그로 기록하고,show == false/deinit에서 그 플래그가 있을 때만 복원해 주세요.수정 예시
public class BaseViewController<T: ViewModel>: UIViewController { let viewModel: T private var baseCancellables = Set<AnyCancellable>() private lazy var networkErrorView = NetworkErrorView() + private var didHideTabBarForNetworkError = false var isShowingTabBar: Bool { true } deinit { - guard isShowingTabBar else { return } + guard didHideTabBarForNetworkError else { return } DispatchQueue.main.async { [weak tabBarController = self.tabBarController] in tabBarController?.tabBar.isHidden = false } } @@ private func handleNetworkErrorView(show: Bool) { if show { view.bringSubviewToFront(networkErrorView) networkErrorView.isHidden = false - tabBarController?.tabBar.isHidden = true + if isShowingTabBar { + tabBarController?.tabBar.isHidden = true + didHideTabBarForNetworkError = true + } } else { networkErrorView.isHidden = true - if isShowingTabBar { + if didHideTabBarForNetworkError { tabBarController?.tabBar.isHidden = false + didHideTabBarForNetworkError = false } } } }Also applies to: 79-88
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Projects/Presentation/Sources/Common/Protocol/BaseViewController.swift` around lines 24 - 28, The controller currently restores the tab bar based on isShowingTabBar which can erroneously unhide the tab bar when this class never hid it; add a private Bool property (e.g., didHideTabBarBySelf) on BaseViewController, set it true at the exact point you hide the tab bar (the method/logic that currently hides the bar), and when restoring the bar (in deinit and the show==false branch) only unhide if didHideTabBarBySelf is true, then reset it to false; apply the same change to the corresponding restore block around lines 79-88 so only the controller that hid the tab bar will restore it.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@Projects/Presentation/Sources/Common/Protocol/BaseViewController.swift`:
- Around line 24-28: The controller currently restores the tab bar based on
isShowingTabBar which can erroneously unhide the tab bar when this class never
hid it; add a private Bool property (e.g., didHideTabBarBySelf) on
BaseViewController, set it true at the exact point you hide the tab bar (the
method/logic that currently hides the bar), and when restoring the bar (in
deinit and the show==false branch) only unhide if didHideTabBarBySelf is true,
then reset it to false; apply the same change to the corresponding restore block
around lines 79-88 so only the controller that hid the tab bar will restore it.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c625cce8-49de-4e38-82ad-f7f0f8be9939
📒 Files selected for processing (2)
Projects/Presentation/Sources/Common/Protocol/BaseViewController.swiftProjects/Presentation/Sources/ResultRecommendedRoutine/View/ResultRecommendedRoutineViewController.swift
🌁 Background
📱 Screenshot
ScreenRecording_03-12-2026.15-06-27_1.mp4
ScreenRecording_03-12-2026.15-06-53_1.MP4
👩💻 Contents
📝 Review Note
1.
isShowingNetworkError프로퍼티 삭제isShowingNetworkError가 아무 역할을 안하는 것 같아가주구 삭제했어요 !!!handleNetworkErrorView함수 내부에서도 show로 처리하는 것 같더라구용 ??? 암튼 잘못 삭제했다면 알려주세요 !!!2.
isShowingTabBar프로퍼티 추가탭바 hidden 여부를 처리하기 위한
isShowingTabBar프로퍼티를 추가했어유근데 상속 받은 View에서 override로 값을 설정해야 해가주구 private으로 못해서 외부 노출 위험이 있습니다 ...
더 나은 방안이 있다면 말씀해주세요 !!!!
Summary by CodeRabbit
릴리스 노트