Skip to content

hoangthuytruc/WeatherForecast

Repository files navigation

Weather App

WeatherForecast is an application to retrieve the weather information for a specific city. The main features include:

  • Retrieve the weather information for a specific city.
  • Add the favorite cities.

Screenshots

Overview

The structure of project

WeatherForecast/
|-- Configuration/
|-- DependencyContainer/
|-- ApiService/
|-- Model/
|   |-- QueryWeather/
|   |-- LocalStorage/
|-- Controllers/
|   |-- Base/
|   |-- Weather/
|   |   |-- SearchResults/
|   |-- WeatherDetail/
|-- LocalStorage/
|   |-- RealmDatabaseService
|   |-- RealmMigration
|-- Utils/
WeatherForecastTests
WeatherForecastUITests

Architectural pattern: MVVM

  • Model: contains the structures of application data.
  • View: contains the visual components of interfaces. They usually handles the logics of view such as clicked button, a view presentation and so on.
  • ViewModel: handle all business logics.

Design patterns:

  1. Dependency Injection (DI): to handle class constructor
  2. Singleton: to manage DI's initialization.

Libraries:

  1. SwiftLint: to check automatically the coding convention.
  2. RealmSwift: to cache favorited cities.

Installation

  1. Download the ZIP for the lastest release.
  2. Extract the content of the zip archive in your project directory.
  3. Open the terminal, run commands:
  cd 'your project directory'
  pod install

Note: If CocoaPods have not been installed, run command:

  $ sudo gem install cocoapods
  1. Open the file WeatherForecast.xcworkspace and Run

Checklist

  • Display the weather information for a selected city, fetched from OpenWeatherMaps API.
  • Allow uses to save their favorite citites using local database.
  • Create a main screen with a search bar and a list of saved favorite cities.
  • Create a detailed screen to display the weather information foe the selected city.
  • Use URLSession for network module.
  • Use Codable for parsing JSON.
  • Use Realm database and implement CRUD operations.
  • UnitTests
  • UITests

Configuration

The OpenWeatherMaps API requires APPID to access its APIs. In case of the default APPID invalid, you can replace it with yours (sign up and get a new one for free), simply use:

  Configuration.appID = 'your APPID'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published