Next step for me is composed of two things:
1 - Change code towards Clean Architecture 2 - Implement API connection
And I know this is going to sound controverse but I´m going to show JSON parsing, I rather talk about this first as I´m getting back to this project and API interaction is going to be piece of cake.
To create our JSONInteractor, which will be responsible for parsing JSON for us we only need JSONSerialization class, really simple and just a few lines of code.
The alternative with empty object/array instead of returning nil is also great.
Just decide how you want to handle errors and exceptions.
Use a pod to do the job for you, handle edge cases, represent JSON null and other JSON related stuff our simple code can´t right now. For instance SwiftyJSON, which is the one I use normally will reduce your code to:
No need for JSONInteractor.
- Using JSON in Swift is simple and easy.
- Mapping JSON in swift is tedious