How tomas2870/habits works
Main components
• App entry point: ProjectApp.swift (SwiftUI’s @main App struct)
• UI layer (Views folder)
• Presentation / business-logic layer (ViewModels folder)
• Data layer (Models folder + Firebase)
• Extensions & Utilities (Other/Extensions.swift)
• External services: Firebase Authentication, Firestore Database
Establish relationships & data flow
a. User taps UI in a View (e.g., LoginView.swift)
b. View binds to a corresponding ViewModel (e.g., LoginViewViewModel.swift)
c. ViewModel performs logic (validates input) and calls Firebase APIs
d. Firebase Auth or Firestore returns success/error
e. ViewModel updates its @Published properties
f. View automatically updates through SwiftUI bindings
Architectural patterns & principles
• MVVM: separate UI (Views), state & logic (ViewModels), data definitions (Models)
• Single source of truth for state in ViewModels
• Dependency inversion: ViewModels depend on abstractions (protocols) for Firebase calls
• Unidirectional data flow: View → ViewModel → Service → ViewModel → View
Technologies & libraries to annotate
• SwiftUI (Views layer)
• Combine (used implicitly via @Published in ViewModels)
• FirebaseAuth (for user registration/login)
• Firestore (for storing Habit and User data)
• Xcode asset catalogs (Other/Assets.xcassets)
Final checklist
[ ] ProjectApp entry point & routing
[ ] All major Views & their corresponding ViewModels
[ ] Models used by ViewModels (Habit, User)
[ ] Arrowed interactions between layers
[ ] Firebase Auth & Firestore represented as external services
[ ] Call out architectural pattern (MVVM) in a corner