How developeracademy-postech/2024-mc2-a01-littlehiker works
Based on our analysis of the file tree and README, the project is an Apple ecosystem application consisting of a watch app with an iOS companion. The “LittleHiker” project is designed to help users (particularly hikers) monitor “충격량” (shock or impact) during a descent and guide them to run faster (as signified by a running squirrel) in order to protect knee health. The project uses Swift and SwiftUI alongside native Apple frameworks such as HealthKit, Core Location, and Notification.
Main Components
• Watch App UI – This includes all the SwiftUI views organized under “LittleHiker Watch App/View”. Examples include WatchMainView, WatchDetailView, WatchKickOffView, and more. These components handle user presentation and interaction.
• iOS Companion App UI – The “LittleHiker/View” folder in the iOS app with ContentView, PhoneListView, and similar views showing the phone’s interface.
• View Models – Both watch and iOS side have view model layers (e.g., HikingViewModel in each platform folder, WatchToIOSConnector and IOSToWatchConnector) that serve as the bridge between UI components and the app’s business logic.
• Managers – Under the “Manager” directories for both apps you see several functional managers (CoreLocationManager, HealthKitManager, ImpulseManager, TimeManager). These encapsulate the logic for accessing device sensors and external frameworks.
• Models – The “Model” folders define data structures (CustomData, HikingStatus, KickOffStatus etc.) that encapsulate the domain logic and data required by the app.
• Shared Components – The “shared” directory contains generic code like DataSource.swift and FileTransferObservers.swift which likely support data sharing or communication between the watch and phone apps.
• App-Level Configuration – There are configuration files like AppDelegate.swift, the *.entitlements files, and the Xcode project files that define how the project is built and deployed.
Relationships and Interactions
• The UI components (SwiftUI Views) interact with the corresponding ViewModels to retrieve and display data.
• ViewModels communicate with the Managers to retrieve sensor data (from HealthKit, Core Location) and handle events like notifications and impulses.
• The Managers interface directly with Apple Frameworks (HealthKit, Core Location, Notification) to perform specialized functions.
• The Models transport data between the ViewModels and Managers.
• The shared module likely facilitates communication between the Watch App and its iOS companion, managed through components like WatchToIOSConnector and IOSToWatchConnector.
• The overall data flow can be depicted as: User Interaction → UI (views) → ViewModel → Managers → Apple frameworks, while the responses propagate back through the same chain.
Architectural Patterns
• The project uses a typical MVVM (Model-View-ViewModel) pattern, which improves testability and module isolation.
• There is a clear separation of concerns: the UI layer (views), the business logic (view models and managers), and the data (models and shared data services).
• Communication between watch and iOS components is modularized into dedicated connectors, an important pattern in multi-device (watch/phone) integration.
Relevant Technologies/Frameworks
• Swift & SwiftUI – Core language and UI framework.
• HealthKit, Core Location, and Notification – For accessing sensor and notification services.
• Xcode project structure elements (AppDelegate, entitlements) – Represent overall app configuration and deployment.
• Shared libraries – Indicate inter-app communication strategies.
Elements
• Use clear labels for each component (e.g., “HealthKitManager”, “WatchMainView”, “IOSToWatchConnector”).
• From UI to ViewModel (user actions, data binding).
• From ViewModel to Manager (where business logic processes sensor data).
• From Manager to Apple Frameworks (actual API calls).
• Between Watch and iOS (using connectors from the shared module).
• Interdependencies, particularly for the cross-device communication connectors.