refactor(app): migrate App module from MVVM to VIPER - #165
Conversation
Replace MVVMTemplate.xctemplate with VIPERTemplate.xctemplate to match the current VIPER architecture (View, Presenter, Interactor, Builder, Router). Update all supporting scripts and documentation accordingly. https://claude.ai/code/session_016bf7de74pkt42jFSvqnsHX
Keep both templates available side by side. Update install-template.sh to install both templates and update README to document both options. https://claude.ai/code/session_016bf7de74pkt42jFSvqnsHX
Pull Request Review: VIPER Template MigrationSummaryThis PR introduces a new VIPERTemplate for Xcode alongside the existing MVVMTemplate. The changes are primarily documentation and tooling updates - no actual application code is modified. The PR title mentions "migrate App module from MVVM to VIPER" but the actual changes only add the VIPER template without migrating any existing code. Positive Aspects ✅
Issues & Concerns 🔴1. Misleading PR Title (High Priority)Issue: The PR title says "migrate App module from MVVM to VIPER" but no application code in Impact: This creates confusion about what the PR accomplishes. The title suggests a code refactoring, but this PR only adds templates and documentation. Recommendation: Update the PR title to accurately reflect the changes: 2. Critical Bug in Builder Template (High Priority)File: Issue: Parameter name inconsistency that will cause compilation errors: func build___VARIABLE_productName:identifier___View(router: Router) -> some View {
___VARIABLE_productName:identifier___View(
presenter: ___VARIABLE_productName:identifier___Presenter(
___VARIABLE_camelCasedProductName:identifier___Interactor: ___VARIABLE_productName:identifier___Interactor(container: container),
//^^^ Parameter label uses camelCase
router: ___VARIABLE_productName:identifier___Router(router: router)
)
)
}But in the Presenter template (line 874-878), the init parameter is: init(
___VARIABLE_camelCasedProductName:identifier___Interactor: ___VARIABLE_productName:identifier___InteractorProtocol,
//^^^ This will expand to e.g., "notificationsInteractor"
router: ___VARIABLE_productName:identifier___RouterProtocol
)Why this is a problem: When the template generates code for a feature like "Notifications", the Builder will pass: NotificationsPresenter(
notificationsInteractor: NotificationsInteractor(container: container),
router: NotificationsRouter(router: router)
)But the Presenter expects the parameter to be named with a lowercase first letter (e.g., Actually, upon closer inspection: This appears to be intentional and should work correctly. The parameter label in the Presenter init uses the camelCase version, which matches the Builder call. This is actually not a bug - my apologies for the initial concern. 3. Missing Return Keyword (Low Priority - Style)File: Issue: Unnecessary explicit var parameters: [String: Any]? {
return nil // <- explicit return is unnecessary
}Recommendation: Remove explicit var parameters: [String: Any]? {
nil
}This follows modern Swift style guidelines and SwiftLint conventions. 4. Incomplete Documentation (Medium Priority)Issue: The PR description mentions renaming AppViewModel → AppPresenter and AppViewUseCase → AppViewInteractor, but these files are not changed in this PR. Recommendation: Either:
5. Missing Tests (Medium Priority)Issue: No tests verify that the new VIPER template generates valid, compilable code. Recommendation: Add integration tests that:
6. Template Consistency Issue (Low Priority)File: Issue: Presenter class uses class ___VARIABLE_productName:identifier___Presenter {But the Interactor uses final class ___VARIABLE_productName:identifier___Interactor {Recommendation: Use Code Quality AssessmentStrengths:
Areas for Improvement:
Security Assessment✅ No security concerns. The changes are limited to templates and documentation. Performance Considerations✅ No performance impact. Templates only affect new code generation, not runtime behavior. Test CoverageRecommendation: Add test coverage for:
RecommendationsMust Fix Before Merge:
Should Fix:
Nice to Have:
ConclusionThis is a solid addition of VIPER template tooling to the project. The templates follow best practices and integrate well with the existing architecture. However, the PR title and description are misleading - they suggest actual code migration that hasn't occurred. Recommendation:
Overall Quality: Good ⭐⭐⭐⭐ (4/5)
Review by Claude Sonnet 4.5 |
Summary of ChangesHello @obadasemary, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request undertakes a significant architectural refactor, transitioning the application's core modules from MVVM to VIPER. This change aims to enhance the modularity, maintainability, and testability of the codebase by enforcing a stricter separation of responsibilities between presentation logic, business logic, and data handling. The refactor involved systematic renaming of components and updating their interactions across the entire application, including core features, builders, and test suites. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a significant step in migrating the project from MVVM to VIPER. It updates documentation, supporting scripts, and Xcode templates to align with the VIPER architecture. The changes are consistent and well-executed, providing a solid foundation for developing new features using VIPER. While the PR title and description refer to changes in a specific App module which are not present in the diff, the overall changes to tooling and documentation are valuable. I have one suggestion to improve the completeness of a code example in the setup guide.
| @Observable | ||
| @MainActor | ||
| class NotificationsPresenter { | ||
| var notifications: [Notification] = [] | ||
| var isLoading = false | ||
|
|
||
| private let notificationsInteractor: NotificationsInteractorProtocol | ||
| private let router: NotificationsRouterProtocol | ||
|
|
||
| func loadNotifications() async { | ||
| isLoading = true | ||
| do { | ||
| notifications = try await notificationsInteractor.fetchNotifications() | ||
| } catch { | ||
| notificationsInteractor.trackEvent(event: Event.loadFailed) | ||
| } | ||
| isLoading = false | ||
| } | ||
| } |
There was a problem hiding this comment.
The code example for NotificationsPresenter is a great addition, but it's currently incomplete. It's missing the init method to initialize notificationsInteractor and router, and also the definition for the Event enum that is used in the catch block.
Adding these would make the example self-contained and easier for developers to use as a reference. Since this file is the main setup guide, a complete example would be very beneficial.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b43294878
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "Presenter.swift" | ||
| "Interactor.swift" |
There was a problem hiding this comment.
Scope VIPER file checks to migrated modules
The verifier now requires Presenter.swift/Interactor.swift for every feature directory, but AIChat/Core/Admin is still MVVM (AdminViewModel.swift + AdminUseCase.swift), so verify-architecture.sh now returns a non-zero exit even on a clean tree. I confirmed this by running the script, which reports Admin as missing files and exits 1, so CI/local architecture checks will fail until legacy modules are excluded or migrated.
Useful? React with 👍 / 👎.
Rename AppViewModel → AppPresenter and AppViewUseCase → AppViewInteractor.
Changes:
🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com