Skip to content

A Kotlin Multiplatform weather app using MVI and fully tested in each layer.

Notifications You must be signed in to change notification settings

MamboBryan/weather

Repository files navigation

Weather

Weather is a simple Kotlin Multiplatform application built with Compose Multiplatform that gets weather information data for a specific city.

Features

  • user can get today's weather data
  • user can get weather data for the next 7 days
  • user can get the last 14 days weather data

Design

android

Loading Today More
loading calorie calorie

iOS

Loading Today More
loading calorie calorie

Architecture

This project uses the MVI(Model - View - Intent) architecture based on UDF(Unidirectional Data Flow) and Reactive programming.

Why?

  • more clear and intentional separation of concerns
  • single source of truth for our UI state which can only be mutated by intent/actions
  • simpler and more direct UI testability, since we can define how the UI should look like with our state objects

Packaging Structure

  • sources
    • remotesource
      • handles getting data from any server/remote source
    • localsource
      • handles getting cached device data
  • data
    • handles getting and mutating data from needed sources
  • domain
    • handles encasing business logic for reuse
  • ui
    • handles displaying data on device

Testing

The app includes both unit and instrumented tests.

Sources


  • Remote
WeatherRemoteSource
loading
  • Local
WeatherLocalSource

In Progress

Data


  • Repositories
WeatherRepository
loading
  • Extensions
DateTime
loading
String
loading
Int
loading

Domain


GetCurrentWeatherDataUseCase
loading
GetHistoryWeatherDataUseCase
loading

ui


  • screen-model
WeatherDetailScreenModel
loading
WeatherListScreenModel
loading
  • screens

Instrumented tests can only run on the JVM so in this app's instance they will run on androidTest

WeatherDetailScreen
loading
WeatherListScreen

In Progress

Stack

Language & Framework

Title Description
Kotlin fun programming language
KMP - Kotlin Multiplatform cross platform framework
CMP - Compose Multiplatform declarative UI rendering framework
Ktor networking client framework

Libraries

Title Description
Kotlinx-DateTime date/time library
Kotlinx-Coroutines async programming
Kotlinx-Serialization serialization
Kamel image loading
Voyager navigation
Koin dependency injection

Improvements

Layered

  • Sources
    • add a local cache for the weather forecast
  • Data
    • get the current day's weather forecast as a flow
    • handle getting data from the remote source and caching it on device
  • UI
    • fix the UX on the dates list screen

General

  • add Air Quality to the details(IMPORTANT!!!)
  • add setup screen for selecting, country, unit of measurement & language
  • add check to show if country has snow or not
  • add ability change selected data
  • add ability to change time from 24hour to 12 hour

About

A Kotlin Multiplatform weather app using MVI and fully tested in each layer.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages