Apple Maps combined with the OpenWeather API written in SwiftUI

Overview

TempAtlas in SwiftUI

TemperatureAtlas uses Apple Maps combined with the OpenWeather API written in SwiftUI.

This project was built to explore SwiftUI beyond the WWDC talks and current documentation


Build Info


  • Xcode 11 beta 2
  • iOS 13.0
  • SwiftUI

Project Details


The app allows the user to view live weather information by either searching for cities supported by the API in the search field or by tapping anywhere on the map. The User can save favorite locations to easily view those forecasts at a later time. Weather information can be toggled between Imperial and Metric units.

Project Structure


Models

The data model for the app is WeatherState. This ObservedObject is used in most views in the app and contains information like the current active units, the current JSON response from the API, the current focused coordinates, the active Favorites, and a boolean flag for when the JSON response isn't nil. The model has some helper functions to handle adding/removing favorites from the local collection as well as saving and loading this information to/from UserDefaults. The file contains the Favorite struct to contain the name and coordinates of a favorite location.

API

The API Group contains the logic for requesting weather data and the struct for capturing the response. WeatherAPI contains the functions to request forecast data from OpenWeater by city and by coordinate. This makes a basic URLSession.shared.dataTask from a URLRequest and calls a completion handler with a flag based on if the call was a success and the response data.

The WeatherResponse file contains all the Codable structs used to decode the API response. One of these structs, Coordinate, has some helper functions to compare two Coordinates and also to convert it to a CLLocationCoordinate2D. This file also extends CLLocationCoordinate2D to add similar functions, one a comparator and the other to convert to a Coordinate.

Landing and Forecast Views

The App is contained in the Landing.swift file. This displays the SearchBar, MapView, ControlsView, and InfoView immediately. These files are part of the Forecast Views Group. The InfoRow View in this group is a building block of the InfoView. Each of these views contains relevant styling and most contain a reference to the app's data model WeatherState either through a @Binding or @EnvironmentObject reference

Modal Views

The Landing View presents a Modal which displays the user's favorites. The ForecastList and FavoriteRow that makes up each cell in the list are contained in the Modal Views Group. The Modal takes the WeatherState Environment Object to make changes to the map when the user selects one of their favorites. It also takes a boolean @Binding to let the Landing page know to dismiss the Modal once it's called to update the map location and forecast information.

You might also like...
Kinopoisk clone iOS app using Swift, TMDb API, Youtube API and SDWebImage.
Kinopoisk clone iOS app using Swift, TMDb API, Youtube API and SDWebImage.

📱 Kinopoisk clone iOS app using Swift, TMDb API, Youtube API and SDWebImage. App mainly developed to learn about Swift(UIKit), working with JSON, using MVVM architectural pattern.

Completed Project for Authentication in SwiftUI using Firebase Auth SDK & Sign in with Apple
Completed Project for Authentication in SwiftUI using Firebase Auth SDK & Sign in with Apple

Completed Project for Authentication in SwiftUI using Firebase Auth SDK & Sign in with Apple Follow the tutorial at alfianlosari.com Features Uses Fir

Social Media platform build with swiftUI and Firebase with google and apple account integration for Signing In Users
Social Media platform build with swiftUI and Firebase with google and apple account integration for Signing In Users

Social Media platform build with swiftUI and Firebase with google and apple account integration for Signing In Users . Providing Users availability to upload posts and images add caption allowing other users to comment , with Find section to explore new people , new stories , User Profile section to allow the user to take control of his account .

Apple products application using SwiftUI

SwiftUI-Prototype In this project I built 2 interfaces for "Apple products" appl

Apple Watch-style activity ring for SwiftUI.
Apple Watch-style activity ring for SwiftUI.

WolfActivityRing Apple Watch-style activity ring for SwiftUI. Originally inspired by Eric Callanan's Create Activity Rings in SwiftUI with a number of

A SwiftUI component which handles logging in with Apple to Firebase
A SwiftUI component which handles logging in with Apple to Firebase

Login with Apple Firebase SwiftUI I made this SwiftUI component to handle logging in with Apple to Firebase. Demo Gif Usage in SwiftUI struct ContentV

This To-Do app was developed using Swift and SwiftUI and works on iOS, MacOS (Apple Silicon) and WatchOS. The tasks are kept on storage even when the app is restarted.

ToDo-SwiftUI This app has a lot of sentimental value for me, given that it helped me a lot to understand the process of doing an iOS app and became th

SwiftUI sample code for Apple's WWDC18 talk
SwiftUI sample code for Apple's WWDC18 talk "Designing Fluid Interfaces".

Fluid Interfaces SwiftUI SwiftUI sample code for Apple's WWDC18 talk "Designing Fluid Interfaces". What is Fluid Interfaces? Fluid Interfaces is a new

IOS15-SwiftUI-InAppPurchaseDemo - In-App Purchase Demo app written with SwiftUI
IOS15-SwiftUI-InAppPurchaseDemo - In-App Purchase Demo app written with SwiftUI

iOS15-SwiftUI-InAppPurchaseDemo In-App Purchase Demo app written with SwiftUI If

Owner
Justin Hatin
Software Developer
Justin Hatin
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
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
WeatherSampleApp - Weather Sample app with SwiftUI consuming data from OpenWeather and using CoreLocation

WeatherSampleApp Weather application using SwiftUI Uses data provided by https:/

Juan Carlos Pazos 3 Jan 14, 2022
Get current weather from openWeather APIs.

JCSWeatherKit JCSWeatherKit is a simple weather library for iOS. It can fetch weather data from OpenWeatherMap. More data sources will be supported an

Asa. Ga 0 Oct 26, 2021
A customizable Snapping Drawer à la Apple Maps.

 100% in SwiftUI.

Snap A customizable Snapping Drawer à la Apple Maps, Apple Music, Stocks, Overcast, etc.. 100% in SwiftUI This is heavily inspired by Rideau and based

Mathias Quintero 632 Jan 4, 2023
A SwiftUI app that fetch images from The Dog API and The Cat API

Cat-Or-Dog-App A SwiftUI app that fetch images from The Dog API and The Cat API, then classify the species of dogs or cats with confidence level. The

null 0 Oct 19, 2021
iAppStroe is an Apple Store tool app written in SwiftUI.

iAppStore 简介 iAppStroe 是一款使用 SwiftUI 打造的苹果商店工具类 App。 1、提供苹果实时榜单查询,包含 iOS 和 iPad 的热门免费榜、热门付费榜、畅销榜,还有新上架榜、新上架免费榜、新上架付费榜等。 2、提供查询 app 详细页面内容、搜索 app、订阅 ap

37iOSTeam 272 Dec 30, 2022
small iOS & ipadOS application written in SwiftUI and Combine, that fetches twitter users and tweets using Twitter's api

HomeTwitter Small iOS & ipadOS application written in SwiftUI and Combine, that fetches twitter users and tweets using Twitter's api. This is just a s

Sorin Miroiu 1 May 13, 2022
MovieAppSwiftUI - The Application is using TMDB API and Server API to reduce user searching movies resources time with search engine

MovieAppSwiftUI The Application is using TMDB API and Server API to reduce user searching movies resources time with search engine.This Application is

JackSon_tm.m 5 Oct 29, 2022
Swift iPhone and iPad Client for Polls API, using Hyperdrive API client

Polls Client This is a Swift iPhone and iPad client for the Polls API - a simple application allowing users to view polls and vote in them. Polls is a

Apiary 34 Jul 15, 2022