How project-qriz/ios works
Project Type and Purpose
• QRIZ is a native iOS “full-stack” examination prep app written in Swift.
• It uses MVVM for presentation, a Coordinator pattern for navigation, and calls out to remote RESTful APIs for auth, exam data, daily quizzes, onboarding surveys, etc.
High‐Level Layer Breakdown
a. App / Life‐Cycle Layer (top)
• Files: AppDelegate.swift, SceneDelegate.swift in QRIZ/App
• Responsibilities: Bootstraps the application, sets up dependency injection, instantiates the AppCoordinator, hands off control to the first navigation graph.
b. Coordinator Layer
• Files: AppCoordinator.swift (root), plus SplashCoordinator, LoginCoordinator, SignUpCoordinator, OnboardingCoordinator, HomeCoordinator, ConceptBookCoordinator, DailyCoordinator, ExamCoordinator, MistakeNoteCoordinator, MyPageCoordinator, TabBarCoordinator in QRIZ/Coordinator and QRIZ/Feature/*/*Coordinator.swift.
c. Presentation Layer
• Folders: QRIZ/Feature/* containing ViewControllers and ViewModels
• Patterns: ViewController <> ViewModel binding via Combine publishers (e.g., using Combine+ extension) or NotificationCenter. Each ViewModel exposes Inputs (user actions) and Outputs (UI state).
• Example: LoginViewController ↔ LoginViewModel; DailyTestViewController ↔ DailyTestViewModel; ExamListViewController ↔ ExamListViewModel.
d. Domain Layer
• Files: Pure business models in QRIZ/Utils/Model and Definitions in QRIZ/Utils/Types
• Responsibilities: Core entities (SubjectType, DailyLearnType, QuestionData, ScoreGraphData, etc.), validation logic, use‐case orchestration.
• Flow: ViewModel calls a use‐case function (e.g., “submitDailyAnswer” or “fetchExamScore”), passing domain models and receiving domain results or errors.
e. Data / Networking Layer
• Folders: Network/Base, Network/DTOs, Network/Service/Auth, Daily, Exam, ExamSchedule, Onboarding, UserInfo
• Components:
– NetworkRequest/NetworkManager handles HTTPMethod, headers, URLSession calls.
– DTOs mirror JSON payloads (e.g., LoginRequest, DailySubmitRequest, ExamResultRequest).
– Services wrap calls and transform DTOs to domain models or throw NetworkError.
• Flow: ViewModel → Service (e.g., LoginService.login) → NetworkManager → HTTP response → DTO → mapping → Domain entity → returns to ViewModel.
f. Resources / Supporting Layer (bottom)
Main Components & Interactions
• AppDelegate → AppCoordinator
• AppCoordinator → Feature Coordinators
• Feature Coordinator → ViewController
• ViewModel → Domain Use Cases
• Use Cases → Service APIs
• Services → NetworkManager → External API
• NetworkManager → DTO → Service → Domain → ViewModel
Architectural Patterns & Principles
• MVVM: clear separation of UI and business logic
• Coordinator pattern: decouples navigation logic from view controllers
• Dependency injection at app bootstrapping
• Single‐responsibility: each service handles one API group; each ViewModel handles one screen flow
• Error propagation: NetworkError bubbles up to ViewModel for user‐friendly alerts (via a Publisher)
Essential Detail
• Every layer’s critical responsibilities and file associations.
• How DTOs map to domain models and propagate through the system.
• MVVM + Coordinator combo.