Weather is a small project that fetches photos and weather from two APIs:
The minimum iOS
version supported is 13.0.
Since it's a small project, I decided to use the MVC approach, but not the way we see around there.
- The
View
classes (for example theMainView
) has all the UI components. - The
ViewController
classes manages the data that is shown in the view and communicates with theServices
classes.ViewControllers
also conforms toProtocols
created for them. The idea is to inject the dependencies that the class will need. Also it helps when developing the unit tests. - I used the ViewCode approach, so there aren't storyboard files. Except for the
LaunchScreen.storyboard
. - There's also a simple
Coordinator
that creates the coordinates the firstViewController
that needs to be shown. - I created an
Environment
class that gets the API Server and API Key from the project's file, that are underBuild Settings > User-Defined
. This approach is helpful when there's Staging and Production environments and we can easily change the environment just changing the scheme. Code coverage
is at 74% the last time I tested.
I like to use Gemfiles to manage Ruby dependencies (CocoaPods and Fastlane).
If you have Bundler installed, follow these steps:
- In the project's folder, run
bundle install
. - Then, run
bundle exec pod install
. - Done! 🎉
If Bundler isn't installed, just run pod install
in the project's folder to install CocoadPods's dependencies.
Then, open weather.xcworkspace
file.
Reviewing this project I noticed that I could've used git flow but I didn't thought about it when I started it, probably because it was a small project and it was just me pushing the changes.