How afalabarce/kmm-template works
Main Components
• Platforms/Clients:
• Android application (androidApp)
• iOS application (iosApp)
• Shared Modules (KMM Common Code):
• Core: Contains platform-agnostic code (common logic, utilities, extensions, and core dependency management).
• Dependency Injection (di): Includes components like CoreDiDependencyInjector and platform-specific DI (for Android and iOS).
• Data Layer: Consists of datasources, models, repository, and database implementations (using sqldelight and DataSource modules).
• Domain: Models, repositories, and use cases that encapsulate the business logic and rules.
• Presentation: UI and viewModels modules to manage user interface logic and state.
• Additionally, testing directories across these modules confirm an emphasis on quality and platform-specific test suites.
Out Relationships and Interactions
• The Android and iOS apps serve as the client layers that host platform-specific code (UI presentation, configuration, manifest files, etc.) and bootstrap the shared modules.
• The shared layer is subdivided into clear layers:
• The Data layer interacts with remote (API) and local (database, data store) sources.
• The Domain layer uses data from the repositories provided by the Data layer and applies business logic via use cases.
• The Presentation layer consumes domain use cases to form view models and UI logic consumed by both mobile clients.
• The Dependency Injection modules (di) ensure that dependencies across these layers are provided in a platform-agnostic manner (with DI frameworks like Koin being hinted by files such as KoinModuleLoader.kt).
• From the UI (androidApp/iosApp) to ViewModels
• From ViewModels to Use Cases (Domain)
• From Use Cases to the Repository/Data layer
• And vice versa for data and event propagation.
Architectural Patterns and Design Principles
• Modular component design that facilitates code sharing across platforms while providing platform-specific implementations for areas like dependency injection and database drivers.
• Use of dependency injection as a core design principle.
• The existence of common test folders indicates a priority on testing and code quality, so consider indicating testing boundaries.
Relevant Technologies and Frameworks
• Kotlin Multiplatform Mobile (KMM) – the core technology allowing for shared code.
• Gradle/Kotlin DSL – project build and dependency management.
• sqldelight – used for generating SQL-based database interfaces in the shared module.
• DI Frameworks (e.g., Koin) – suggested by file names like KoinModuleLoader.kt.
• Standard Android and iOS specifics (e.g., AndroidManifest.xml, Xcode project files).