World Weather is a relatively simple iOS app that allows you to check the current weather for any city in the world.
In the search bar, start to type the city name for which you want to see the weather. As you type, you will get city names below the search bar. Tap the city name you want to see the weather for and it will show on the screen.
This project is my first step in learning MVVM design pattern for iOS. In this app I am using the simple approach of Boxing to bind the View to the ViewModel. The goal is to upgrade the app to use RxSwift.
Weather data is pulled from free Web APIs from openweathermap.org. To use the app, you would have to create an account with openweathermap.org and get the API key. Set the API key as an environment variable with name OpenWeatherApiKey.
From openweathermap.org, a JSON file is also available which has names of all the cities for which the weather data is available from their API. This app uses that JSON to provide the cities names.
One of the main advantages of MVVM is improved testability.
So also included in this project are unit tests of the weather view model. To testing binding of views to viewModel, the test cases use XCTestExpectation
to test async calls.
Weather | City name suggestions | Weather |
---|---|---|