Skip to content

A simple weather forecast application with data provided from OpenWeatherMap.

Notifications You must be signed in to change notification settings

longkimhoang/WeatherForecast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e9950af · Nov 15, 2021

History

25 Commits
Nov 13, 2021
Nov 12, 2021
Nov 12, 2021
Nov 11, 2021
Nov 13, 2021
Nov 11, 2021
Nov 12, 2021
Nov 12, 2021
Nov 12, 2021
Nov 12, 2021
Nov 11, 2021
Nov 12, 2021
Nov 15, 2021
Nov 12, 2021

Repository files navigation

Weather Forecast Example Application

Makefile CI

Author: Long Kim

This repo contains the source code for a simple weather forecast application with data provided from OpenWeatherMap.

Requirements

  • iOS 11.0+ (to provides proper support for safe areas)
  • Xcode 13.0
  • Java Development Kit (must be JDK 11).

How to run locally

# Set JAVA_HOME to JDK 11 if you haven't already
export JAVA_HOME=/some/path/that/contains/jdk/Home

make install_buck # will download a buck executable at tools/buck
make project

Then Xcode will open the generated workspace for you.

Architectural Design

The project applies the MVVM design pattern, coupled with dependency injection to achieve a clean and modular codebase.

This brings many advantages:

  • Separates the view layer from the business logic. In traditional MVC pattern, particularly in iOS development, the view controller knows too much about the data access, business logic etc. With MVVM, it only needs to know about the view model, and responds to data changes by observing this view model object.
  • Promotes a modular architecture. This enhances the development experience, allowing work to be done to different modules at the same time, as well as making writing unit tests much easier.
  • DI abstracts the implementation from the interface. This allows mocking in testing for faster/more reliable unit tests, while the level of abstraction means that your implementation of a class can evolve without breaking existing code, leading to longer and more error-prone development process.

Project Structure

The project is built using Buck, a build system developed and used by Facebook. It encourages the creation of small, reusable modules consisting of code and resources, and supports a variety of languages on many platforms.

The project is structured into multiple modules, which provides logical separation as well as speed up builds, as independent modules can be built in parallel. The following graph represents the current modules in the application:

Dependency Graph

The main modules are:

  • WeatherForecastCore: contains the business logic.
  • WeatherForecastNetworking: provides request/response handling.
  • WeatherForecastUI: provides view layer-related facilities (data sources, view models, etc.)
  • Resources: contains app resources (storyboards, strings, XIBs etc.)

Third-party Frameworks and Libraries

  • Alamofire: Provides HTTP networking for the application.
  • AlamofireImage: Provides image deserialization, bitmap decoding in the background and a simple caching mechanism, which greatly improves image loading and rendering performance for the application.
  • Swinject: Provides dependency injection for the application.
  • DiffableDataSources: A backport of Apple's UITableViewDiffableDataSource (iOS 13.0+) for iOS 9.0+, which provides a data source that can compute inserts/deletes/moves efficiently and less error-prone than traditional performBatchUpdates.

Continuous Integration (CI)

This project is configured with GitHub Actions, which will run tests automatically on every push.

Below is the output of an example run, which is triggered on a push:

GitHub Action

Checklist

  • Programming language: Swift is required, Objective-C is optional.

  • Design app's architecture (MVC or MVP, MVVM).

  • UI should be looks like in attachment.

  • Write UnitTests (nice to have).

    • Networking Code
    • Weather Forecast Fetching Logic
    • UI Test

    Current coverage: Coverage

  • Exception handling (optional). The app can handle cases where city is not found, and a generic error case.

  • README file is included.

About

A simple weather forecast application with data provided from OpenWeatherMap.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published