Cognito KMM Template
  • Welcome
  • Getting Started
    • Quickstart: Getting Started
    • Prerequisites
    • Installation
    • Creating New App
  • Architecture
    • Overview
    • Modules
    • Data Flow
  • Feautures
    • Http Client
    • DataStore
    • Analytics
    • AdMob Integration
    • Crash Reporting
    • Built in Settings Page
  • Handle View States
    • StatelessSurface<T> Composable
    • Handle a screen with 3 states
  • Sequential Content with IndefiniteSurface
  • Handle multiple predefined states
  • Showing Paginated Data
  • Handling list data
Powered by GitBook
On this page
  1. Architecture

Modules

Modules of template

PreviousOverviewNextData Flow

Last updated 8 months ago

Module Descriptions

App Modules

Purpose:

  • Serve as the entry points for Android and iOS applications.

  • Provide the initial context for the app's lifecycle.

Functionality:

  • Handle platform-specific initialization tasks, such as setting up the app environment, registering components, and launching the main activity or view controller.

  • Configure app-specific settings, including app name, icon, theme, and permissions.

  • Integrate with platform-specific services and APIs, like push notifications, location services, and in-app purchases.

Key Characteristics:

  • Minimal code, primarily focusing on platform-specific configurations.

  • Relies heavily on the Library and Shared modules for shared components and logic.

  • Can be customized for specific app requirements, but generally follows a standard structure.

Library Module

Purpose:

  • Centralize reusable code components that can be shared across multiple projects.

  • Provide a foundation for common functionalities and best practices.

Functionality:

  • Implement essential utility functions and data structures, such as networking, caching, logging, and error handling.

  • Offer pre-built components for common UI elements, like buttons, text fields, and dialogs.

  • Provide abstractions for platform-specific APIs, making code more portable.

Key Characteristics:

  • Highly modular and well-organized structure.

  • Comprehensive unit tests to ensure code quality and reliability.

  • Extensible and customizable to fit different project needs.

Shared Module

Purpose:

  • House code components that are shared across different apps within the project.

  • Facilitate code reuse and maintainability.

Functionality:

  • Implement business logic, data models, and UI components that are common to multiple apps.

  • Leverage Kotlin Multiplatform Mobile (KMM) to share code between Android and iOS platforms.

  • Provide a platform-agnostic layer for common functionalities, such as authentication, data synchronization, and feature flags.

Key Characteristics:

  • Utilizes KMM's commonMain, androidMain, and iosMain source sets for platform-specific implementations.

  • Follows a clear separation of concerns between platform-independent and platform-specific code.

  • Encourages code sharing and consistency across the project.

Scripts Directory

Purpose:

  • Automate app and code generation tasks to improve efficiency and reduce manual effort.

Functionality:

  • Contains scripts that can be executed from the command line to perform various tasks, such as:

    • Generating new app modules with a predefined structure.

    • Creating boilerplate code for common components and features.

    • Updating dependencies and configurations across multiple modules.

    • Running build and testing processes.

Key Characteristics:

  • Uses scripting languages like Bash or Python to automate tasks.

  • Customizable to fit specific project requirements and workflows.

  • Can be integrated with continuous integration (CI) pipelines for automated builds and testing.

Example Directory

Code generation script uses example to generate new code. So it shouldn't be changed or deleted in any way. If you know how it works you may tweak it according to your needs.

If you have multiple files, GitBook makes it easy to import full repositories too — allowing you to keep your GitBook content in sync.