A simple open-source weather app for iOS that uses the OpenWeatherMap API

NearbyWeather

NearbyWeather is a simple weather app, that provides current weather information for nearby cities, as well for bookmarked locations. NearbyWeather uses the OpenWeatherMap API to download weather data. Additionally the OpenWeatherMaps location database is directly bootstrapped into the app for quick access.

With NearbyWeather you can:

  • See current weather information for bookmarked and nearby places via a list and a map view
  • See the current temperature on your app icon
  • Detailed weather information is offered in addition to the overviews
  • Add places as bookmarks via OpenWeatherMaps weather-station data base
  • Choose your preferred units (celsius/fahrenheit/kelvin & kilometres/miles)
  • Access previously loaded data offline

Please note that you need to supply your own OpenWeatherMap API key, in order to use the app. A free tier API key only allows for 60 requests per minute, which may only be sufficient for a single user. As the app is available at no charge, a paid tier API key can not be included.

Downloading data for a bookmarked location counts as one request. Downloading bulk data for nearby places also counts as a single request, regardless of the amount of results you choose. You can add bookmarks indefinitely, but for example exceeding the 60 requests limit with a free tier API key may result in a failure to download data (this scenario has not been tested and depends of the tier of your API key).

Goals of this Project

NearbyWeather should help you as a reference for your development. Whether you just started iOS development or want to learn more about Swift by seeing in action, this project is here for your guidance. Idealy you already have gained some experience or got your feet wet with mobile development. NearbyWeather is created to teach basic principles of iOS development, including but not limited to:

  • Programming concepts such as delegation, closures, generics & extensions
  • Avoidance of retain cycles
  • Swift language features such as codables
  • Persisiting data
  • Using various UIKit classes
  • Various Apple-iOS-Components such as UserDefaults or NotificationCenter
  • Using MapKit and customising maps
  • Accessing and using the user's location
  • Language localization
  • Network requests
  • Using 3rd part REST-APIs
  • Using 3rd party libraries via CocoaPods
  • Using support scripts for creating bootstrapped/bundle resources
  • Accessing bootstrapped/bundle resources
  • "DevOps" tools such as Fastlane or SwiftLint

It therefore otherwise refrains from advanced concepts. The architecture is kept simple by using Apple's recommended MVC pattern. This architecture is fine for a small projects like this one. For complex apps there are better options, such as MVVM, VIP (Clean Swift) or even VIPER. The chosen architecture may for example limit the testability of the project, but then again for simplicty sake there are no unit tests present at all. Additionally the app uses singeltons for all services and managers. This further hinders testing. A better approach to enable this would be dependency injection. Furthermore delegation is used only losely.

Getting Started

In order to get started, fork the project and clone it to your local machine.

In order to open the project and in oder to run it, you will need to have the latest Apple developer tools installed, namely Xcode.

For libraries this app uses the dependency manager Cocoa Pods. Pods are not checked into the repository, so you will have run pod install after cloning. Additionally it might be helpful to set up signing through fastlane match. Create your own repo to store your personal sigining certificates and provisioning profiles and adapt the ./fastlane/Matchfile accordingly. Make sure to never commit these changes or your pull requests will be rejected.

Additionally this project is gathering anonymus crash reports and anonymus usage statistics through Google Firebase. Google supplies a project configuration file in the form of the .plist-file GoogleService-Info.plist. This file is not checked into this repository as it contains secrets. In order to run the project remove the file reference from it and uninstall the pod Firebase/Analytics by removing the lines that start with pod 'Firebase/Analytics' and with pod 'Firebase/Crashlytics' from the podfile and executing pod install. Make sure to never commit these changes or your pull requests will be rejected.

Contributing

We looking forward to receiving your contributions. You can find more information in the contribution docs.

Additionally you may also assist as a beta tester. Periodically test-builds will become available via Testflight. In order to take part in testing those submit an email address used as an Apple-ID to erikmartens.developer@gmail.com to be added to the list of testers.

Future Developments

  • Integrate RxSwift
  • Re-Build Routing using RxFlow
  • Integrate Realm for data persistence
  • Refactor scene-architecture using MVVM+C pattern with RxSwift
  • Write XCTests
  • Setup CI and CD with Bitrise

GitHub