GithubHelp home page GithubHelp logo

assessment-goat's Introduction

Goat Weather (โœ…)

Overview

Welcome to the Goat Weather App! This iOS application serves as a demonstration for implementing a simple weather widget and serves as a coaching tool for junior iOS engineers. The app showcases various features, including displaying weather information using the OpenWeatherMap API, allowing users to set their own images from their gallery, and presenting the current weather in a widget.

Minimum Specification

  1. Widget Options:
  • The app displays three widget options using a UICollectionView with custom cells. Location and Weather:
  1. Requests location permission from users.
  • Connects to the OpenWeatherMap API to fetch the current weather.
  • Implements error handling for users who deny location permission.
  1. Automatic Location Assignment and Weather Display:
  • Automatically assigns users' location based on their device information. Displays weather conditions such as Sunny, Cloudy, Sun behind cloud, Raining, and Snow.
  1. User Image Selection:
  • Allows users to set their own image from their gallery. Requires access to the Photo Library using NSPhotoLibraryUsageDescription.
  1. Weather Widget:
  • Shows the current weather in a widget using WidgetKit.

Implementation Details

Network Layer

The application follows a structured network layer with the following components:

  1. NetworkService: Handles making requests and returning responses as data or failures in the form of NetworkError.
  2. NetworkClient: Where users make requests and receive decodable responses if the result is successful.
  3. Provider: Customizes network requests, including path endpoint, API key, and parameters.

Weather Display

To display weather conditions, the app utilizes the OpenWeather API's icon inside the JSON response. The recommended URL for weather icons is http://openweathermap.org/img/wn/{icon}@2x.png.

Photo Library & Location Access

For users to set their own images from the gallery, the app requests access to the Photo Library using NSPhotoLibraryUsageDescription. The UIImagePickerControllerDelegate is implemented to access the user's gallery. And for Location using NSLocationAlwaysUsageDescription

Widget Implementation

The app includes a Widget Extension to implement WidgetKit. Shared data between the app and the widget is achieved through app group capabilities, enabling data sharing between extensions.

Architecture

The app follows the MVVM architecture with Combine. This choice is made due to Combine's built-in publisher for any property compliant with Key-Value Observing. It allows the coordination of multiple publishers and their interaction, making it ideal for handling updates from various components.

- Application
     - Services
          - Network
               - NetworkService
               - NetworkClient
               - NetworkError
               - Request (Provider)
          - Database
               - FileManager (for saving selected images)
               - UserDefaults (for saving coordinates)
     - UI
     - Modules 
          - ViewModel
          - View
          - Model / Entities

This folder structure organizes the application into clear sections, making it easier for developers to navigate and understand the codebase.

Getting Started

To start the project, simply open the file Goat-Weather.xcodeproj.

Adding a New Feature

To create a new feature, start by creating a new folder with the name of your new feature inside the Goat-Weather folder. This helps maintain a clean and organized project structure.

Feel free to explore and build upon this Weather Widget App as you continue your journey in iOS development!

Preview

iPhone SE 3, iOS 17

iOS

assessment-goat's People

Contributors

yefga avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.