An application to fetch the weather forecast of multiple cities. The user can get the user's current city weather forecast details and user can search by using citynames. If the user is searching by city name, th user should enter minimum 3 cities and he can enter maximum 7 cities. The multiple city names will be comma seperated.
We are using OpenWeather API to get the weather forecast details.
- Clone this repo.
- Open
WeatherForecast.xcworkspace
and run the project on selected device or simulator.
Thrid party framewoks and Library are managed using Cocoapods.
- pod 'Alamofire'
- pod 'AlamofireImage'
Here, we are using MVVM architectural pattern.
- Model folder contains all the models.
- View folder contains all the ViewControllers and views.
- ViewModel folder contains all the business logics.
- Helper folder contains Network Engine, Constants and some utility files.
- NetworkCalls contains all the web service calls.
- Supporting file contains AppDeletegate, Storyboards and images.
- Extensions contains the added extension files.
There are total 4 screens for this application
- Splash screen.
- Home screen
- The name of the ViewController is
WeatherForecastByCityNameViewController
- This ViewController is managing all the tasks related to getting weather forecast reports by entering city names.
- The name of the ViewController is
- City name selection screen
- If the user typed cityname is not unique, then we will show a list of available city names and ask the user to select their desired city name.
- This is managed by
CityNameSelectionViewController
- Current location screen
- Here we will show the 5 days weather forecast deatils of the user's current location.
- We will get the current location by using GPS.
- This is managed by
CurrentLocationViewController
We are using Slather to get code coverage report.
To install the gem, open terminal and copy paste the below command
sudo gem install slather
- Open
WeatherForecast.xcworkspace
- Click
command + U
or go toProduct
->Test
- Now the xcode will start build and run the test cases.
- Click the Test Navigator icon to view the status and results of the tests.
- Make sure that the slather is installed.
- Run the test cases on Xcode.
- Open
Terminal
- Then run (Replace the path/to/ with the exact path of the file)
- After finishing, a new window will be open in your browser with the code coverage report.
slather coverage --show --html --scheme WeatherForecast --workspace path/to/WeatherForecast.xcworkspace path/to/WeatherForecast.xcodeproj
If you are installing to a device having iOS 13.3.1, please add a Provisioning Profile with a valid developer account. Many developers reported a crash due to this reason.