Ios-weather-app - A simple weather app with swift

Overview

AHOY Assignment

Weather app

Main Screen Settings
architecture architecture

Architecture

architecture

The Architecture used is MVVM:

  • The View

The view has the sole purpose of showing information to the user and to inform the viewmodel of the user's actions. The key concept of this app is that each viewController does not contain any logic which is easily identifiable by if statements :)

  • The ViewModel

The viewModel - I have called this the presenter to make naming easier and avoid naming conflicts :) The ViewModel is where the logic of the app sits. It also aggregates other services like repositories, router and analytics engine (if we had one).

I have set up mine in such a way that it uses closures instead of another view protocol as a way that it calls back to the view and all closures are weak so as to avoid any retain cycles.

  • Model

The model stores data that is directly related to the view and is easily usable by the view without much transformation: like: User Friendly Dates, scroll position, `Strings that we'll show on the screen`` etc, basically stores the view's state.

  • Repository

The repository knows how and where it can fetch and return the requested data. The repository inturn uses the dumb services that specializes in fetching data from a specific source like Network, Cache, Keystore  , etc.

  • Entity

The Entity is simply used by the repository to store and query data. Usually maps one to one with the data returned from the services used within the repository. For example mapping one to one with JSON from server

  • Router

The router is responsible for all the routing that each screen needs, it is is owned by the ViewModel so that it easy to test.

  • Service

The service specializes in data access eg from a server, cache, Keystore  

Other Notable Design Decisions

Folder structure

Notable Folders

  • Common: Contains all shared components of the app, components that are used by more than one screen, this includes Extensions, Logger, Shared Views etc

  • Features

Each Feature has all its architecture components localized to that Features folder - It makes it easier to navigate the code therefore making it easy to maintain that screen

Screens/Views

Each View has its xib in the same folder. so that we avoid having a bloated main xib that is difficult to merge because of merge conflicts. Having one xib per view makes it easy to work on that screen and make any modifications.

Image Caching

I've used SDWebImage to download and cache images for me so that we have smooth scrolling experience

Final thoughts and Improvements

I would have love to write test for the presenters at the very least , but I've made sure that the each layer of the Archtecture is testible by using protocols so mock instacies can be injected when testing.

I would've also loved to try and secure the API KEY instead of leaving in plain sight as it is right now.

Added a Logger.swift that only logs in development.

I didn't do the following as I believe the current project clearly demonstrates my capabilities:

  • Tapping on an item should open weather details view
    • The settings screen demostrates moving from one screen to the next, the only thing missing is passing data to the next screen
  • Local Notifications to show weather alert
  • Offline/Local storage (preferably Realm Framework)
  • Unit tests
  • Update weather info frequently in the background

I mainly focused on the architecture of the application and showcasing my deep understanding of the iOS SDK and swift.

Looking forward to hearing from you and what are your thoughts and pitfalls of these architectural decisions :)

You might also like...
Simple weather application in Swift for iOS 15.
Simple weather application in Swift for iOS 15.

DaWeather ⛅️ Simple weather application in Swift for iOS 15. General Information DaWeather ⛅️ will help you determine the current weather Features Get

WeatherApp - A simple Weather App using Realm
WeatherApp - A simple Weather App using Realm

WeatherApp A simple app to preview 16 day forecast and: Show a list of weather f

Simple and minimalist weather app that displays the current conditions.
Simple and minimalist weather app that displays the current conditions.

Minimalistic Weather App Project Description In this project, I have developed a simple and minimalist weather app, where I use the Current Weather Da

A simple weather forecast application with data provided from OpenWeatherMap.
A simple weather forecast application with data provided from OpenWeatherMap.

Weather Forecast Example Application Author: Long Kim This repo contains the source code for a simple weather forecast application with data provided

WeatherApps - Simple Weather Apps Using Core Location
WeatherApps - Simple Weather Apps Using Core Location

Simple WeatherApps Using Core Location To Get The Actual Position Using API from

A simple clean application to provide you with weather forecast data as well as currency rates, all with beautiful melodies and sounds
A simple clean application to provide you with weather forecast data as well as currency rates, all with beautiful melodies and sounds

A simple clean application to provide you with weather forecast data as well as currency rates, all with beautiful melodies and sounds.

Weather app for iOS with swift
Weather app for iOS with swift

Weather app Codable Protocol Getting data from Open Weather API and using JSON D

A fluent Collapsing header view like iOS Contacts detail and Weather App

FluentCollapsingHeaderView A Collapse Header View like iOS Weather App Credits FluentCollapsingHeaderView is owned and maintained by the Seyed Samad G

Clima is an amazing weather app for iOS
Clima is an amazing weather app for iOS

ClimaApp Clima App é um iOS App desenvolvido em Swift. Clima é um incrível app que mostra o clima da localidade que você deseja saber, esse app foi fe

Owner
null
Weather - Use Open weather APIs to fetch live weather data

Weather ??️ Use Open weather APIs to fetch live weather data Use Core Location p

Vicky Lee 2 Jun 3, 2022
Ios-weather-app - A simple weather app with swift

AHOY Assignment Weather app Main Screen Settings Architecture The Architecture u

null 0 Jan 29, 2022
Weather-app - Created a simple weather app on Xcode using SwiftUI, only shows one location

weather-app Created a simple weather app on Xcode using SwiftUI, only shows one

Rahul Kadiyala 1 Feb 11, 2022
A Simple Weather App Using the Open Weather Map api

The Weather, a Simple Weather App Using the Open Weather Map api. This app demos use of the Open Weather Map api. The UI is simple, with views of the

null 1 Feb 17, 2022
Simple Weather app to display future weather of 3 cities

WeatherApp Simple Weather app to display future weather of 3 cities Test project for a small weather application Overview For the test project a small

null 0 Nov 28, 2021
WeatherApp - A simple weather app utilizing Google Places API for search and OpenWeather for weather data

Swift Weather App About A simple weather app utilizing Google Places API for sea

null 0 Jan 5, 2022
Swift Language Weather is an iOS weather app developed in Swift

Swift Language Weather SwiftWeather has renamed to Swift Language Weather. Because this repo is ranked number one in Google when we search "Swift Weat

Jake Lin 5.2k Jan 7, 2023
A SwiftUI Weather App powered by World Weather Online API

SwiftUI-Weather The SwiftUI Weather app, allow users get the current weather for a particular locatio and view a 5-day weather forecast for the select

Dionysis Karatzas 6 Sep 29, 2022
Weather forecast app that allows the user to either look for weather at their current location based on the GPS data or search for another city manually.

⛅️ Cloudy Weather forecast app that allows the user to either look for weather at their current location based on the GPS data or search for another c

Burhan 0 Nov 7, 2021
LiveWeatherApp - Live Weather App - Displays Live Weather Data with OpenWeather API

Live Weather App - Displays Live Weather Data with OpenWeather API Learned about

Matt Wong 1 Feb 5, 2022