This is a Kotlin Multiplatform project targeting Android and iOS, demonstrating a clean architecture approach to share business logic while leveraging platform-specific reactive programming patterns.
The project uses a shared ViewModel architecture with platform-specific state management:
- Shared Business Logic: Common Kotlin code defines the core functionality through interfaces
- Platform-Specific State Management:
- Android: Uses Kotlin StateFlow for reactive state updates
- iOS: Uses Combine Publishers for reactive state updates
CounterViewModel: Shared business logic implementationCounterViewModelState: Interface that abstracts platform-specific state management- Platform-specific implementations of
CounterViewModelState:- Android: Uses
StateFlowfor reactive updates - iOS: Uses Combine
Publisherfor reactive updates
- Android: Uses
- Code Sharing: Core business logic is written once in Kotlin and shared across platforms
- Platform-Native Feel: Each platform uses its preferred reactive programming paradigm
- Clean Architecture: Clear separation between shared business logic and platform-specific implementations
- Type Safety: Interface-based approach ensures type safety across platforms
- Maintainability: Single source of truth for business logic while maintaining platform-specific best practices