-
Notifications
You must be signed in to change notification settings - Fork 0
[Refactor] 로그인 화면 코디네이터 패턴 적용 #279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Walkthrough프로젝트에 LoginCoordinator를 추가하고, SceneDelegate에서 로그인 초기화 흐름을 코디네이터 패턴으로 전환했다. LoginViewController는 내부 네비게이션 메서드를 제거하고 외부 콜백(클로저) 기반으로 전환됐다. Xcode 프로젝트 설정에 신규 Swift 파일이 빌드 타깃과 그룹에 포함됐다. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant App as App
participant Scene as SceneDelegate
participant Nav as UINavigationController
participant Coord as LoginCoordinator
participant LVC as LoginViewController
participant Sheet as WableSheetViewController
participant OnbNav as UINavigationController (hidden)
participant Onb as LCKYearViewController(.flow)
participant Home as TabBarController
App->>Scene: willConnect
Scene->>Nav: 생성(네비바 hidden)
Scene->>Coord: 생성(navigationController: Nav)
Scene->>Coord: start()
Coord->>LVC: 생성(LoginViewModel 주입,<br/>navigateToOnboarding / navigateToHome 할당)
Coord->>Nav: LVC push
note over LVC,Coord: 로그인 화면 표시
LVC-->>Coord: navigateToOnboarding()
Coord->>Sheet: 생성(타이틀/메시지, 액션 등록)
Coord->>Nav: Sheet present (modal)
Sheet-->>Coord: 액션 탭
Coord->>OnbNav: 생성(root: Onb, hidden)
Coord->>Nav: OnbNav present (fullScreen)
LVC-->>Coord: navigateToHome()
Coord->>Home: 생성
Coord->>Nav: Home present (fullScreen)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the login screen to implement the coordinator pattern by introducing a LoginCoordinator that manages navigation responsibilities previously handled directly by the LoginViewController.
- Extracted navigation logic from the view controller into a dedicated coordinator
- Modified the SceneDelegate to use the coordinator for initializing the login screen
- Introduced closure-based communication between the view controller and coordinator
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| LoginViewController.swift | Removed navigation methods and replaced with closure properties for coordinator communication |
| LoginCoordinator.swift | New coordinator class implementing navigation logic extracted from the view controller |
| SceneDelegate.swift | Updated to instantiate and use the LoginCoordinator instead of directly creating the LoginViewController |
| project.pbxproj | Added the new LoginCoordinator.swift file to the project |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| func showHome() { | ||
| let tabBarController = TabBarController() | ||
| tabBarController.modalPresentationStyle = .fullScreen |
Copilot
AI
Sep 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The modalPresentationStyle should be set consistently. In showOnboarding() it's set on line 37, but here it's set separately. Consider extracting this common configuration or ensuring consistent patterns across both methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (6)
Wable-iOS/App/SceneDelegate.swift (2)
26-27: loginCoordinator 수명 관리강한 참조로 잡아두는 건 좋아요. 다만 홈 전환 이후에는 로그인 스택과 코디네이터를 해제해 메모리/상태를 정리하는 편이 안전합니다. 예: 홈으로 전환 직후
loginCoordinator = nil.
65-70: 로그인 루트 구성은 적절하나, 홈 전환과의 일관성 필요여기서는 window.root를 네비게이션 컨트롤러로 교체하지만, LoginCoordinator.showHome은 모달 present로 탭바를 올립니다. 스택이 중첩되어 뒤에 로그인 스택이 남습니다. 전환 방식을 일관화(루트 교체 or 네비 스택 교체)하는 것을 권장합니다.
추천:
- 옵션 A(간단): showHome에서
navigationController.setViewControllers([TabBarController(shouldShowLoadingScreen: true)], animated: true)- 옵션 B(엄격): 루트 교체를 SceneDelegate로 위임(델리게이트/클로저)해
window.rootViewController = TabBarController(...)로 일원화Wable-iOS/Presentation/Login/LoginViewController.swift (2)
44-62: 불필요한 lazy 제거self 캡처가 없고 재할당도 없으므로 lazy var 대신 let 사용이 더 간결합니다.
다음처럼 변경을 권장합니다:
- private lazy var kakaoButton: UIButton = UIButton().then { + private let kakaoButton: UIButton = UIButton().then { ... - private lazy var appleButton: UIButton = UIButton().then { + private let appleButton: UIButton = UIButton().then { ...
158-159: Void 호출에 삼항 연산자 사용 지양SwiftLint 경고(void_function_in_ternary). if/else로 명확히 표현하세요.
다음으로 교체를 권장합니다:
- condition ? owner.navigateToOnboarding?() : owner.navigateToHome?() + if condition { + owner.navigateToOnboarding?() + } else { + owner.navigateToHome?() + }Wable-iOS/Presentation/Login/LoginCoordinator.swift (2)
28-43: 온보딩 진입 시 문자열 하드코딩 제거 제안제목 "앗 잠깐!"을 StringLiterals로 이동해 일관된 리소스 관리와 i18n 대비를 추천합니다.
46-49: 홈 전환: present 대신 스택 교체로 일관성/메모리 개선모달 present는 로그인 스택을 뒤에 남깁니다. 네비게이션 스택 교체가 더 깔끔합니다. 또한 SceneDelegate의 메인 진입과 동일하게 로딩 스크린 옵션을 맞추세요.
권장 변경:
- let tabBarController = TabBarController() - tabBarController.modalPresentationStyle = .fullScreen - navigationController.present(tabBarController, animated: true) + let tabBarController = TabBarController(shouldShowLoadingScreen: true) + navigationController.setViewControllers([tabBarController], animated: true)대안(루트 교체 일원화):
- 코디네이터 -> SceneDelegate로 콜백을 노출해
window.rootViewController = TabBarController(shouldShowLoadingScreen: true)수행.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
Wable-iOS.xcodeproj/project.pbxproj(4 hunks)Wable-iOS/App/SceneDelegate.swift(2 hunks)Wable-iOS/Presentation/Login/LoginCoordinator.swift(1 hunks)Wable-iOS/Presentation/Login/LoginViewController.swift(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
Wable-iOS/App/SceneDelegate.swift (1)
Wable-iOS/Presentation/Login/LoginCoordinator.swift (1)
start(11-24)
Wable-iOS/Presentation/Login/LoginCoordinator.swift (1)
Wable-iOS/Presentation/TabBar/TabBarController.swift (1)
tabBarController(162-193)
🪛 SwiftLint (0.57.0)
Wable-iOS/Presentation/Login/LoginViewController.swift
[Warning] 158-158: Using ternary to call Void functions should be avoided
(void_function_in_ternary)
🔇 Additional comments (6)
Wable-iOS.xcodeproj/project.pbxproj (4)
182-182: Sources 빌드 파일 추가 확인LoginCoordinator.swift가 Sources에 정상 추가되었습니다.
569-569: 파일 레퍼런스 추가 확인LoginCoordinator.swift 레퍼런스가 프로젝트에 정상 등록되었습니다.
1308-1309: 그룹 배치 적절Presentation/Login 그룹 하위에 배치되어 구조적으로 일관적입니다.
2954-2955: 빌드 페이즈 편입 OK메인 타깃의 Sources에 1회만 편입되었는지 확인됨. 중복 추가는 없습니다.
Wable-iOS/Presentation/Login/LoginViewController.swift (1)
20-22: 네비게이션 콜백 분리 좋습니다코디네이터로 내비게이션을 위임하는 형태가 명확하고 테스트/유지보수에 유리합니다.
Wable-iOS/Presentation/Login/LoginCoordinator.swift (1)
11-24: start 구성 및 약한 캡처 적절뷰모델/뷰컨 생성과 [weak self] 캡처가 적절합니다. 코디네이터 순환 참조 위험도 낮습니다.
JinUng41
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다~
…ator [Refactor] 로그인 화면 코디네이터 패턴 적용
👻 PULL REQUEST
📄 작업 내용
SceneDelegate,LoginViewController에 코디네이터 패턴을 적용헸어요.✅ 이번 PR에서 이런 부분을 중점적으로 체크해주세요!
잠깐 확인하고 갈까요?
들여쓰기를 5번 이하로 준수했는지, 코드 가독성이 적절한지 확인해주세요.
한 줄당 120자 제한을 준수했는지 확인해주세요.
MARK 주석이 정해진 순서와 형식에 맞게 작성되었는지 확인해주세요.
반복되는 상수 값이 있는지, 있다면 Constant enum으로 분리되어 있는지 확인해주세요.
삼항 연산자가 길어질 경우 적절히 개행되어 있는지 확인해주세요.
조건문에서 중괄호가 올바르게 사용되었는지 확인해주세요.
라이브러리 import가 퍼스트파티와 서드파티로 구분되고 알파벳순으로 정렬되었는지 확인해주세요.
용량이 큰 리소스나 호출되지 않을 가능성이 있는 프로퍼티에 lazy var가 적절히 사용되었는지 확인해주세요.
메모리 누수 방지를 위한 weak 참조가 필요한 곳에 적용되었는지 확인해주세요.
도메인 로직과 UI 로직이 적절히 분리되어 있는지 확인해주세요.
🔗 연결된 이슈
Summary by CodeRabbit