Scalable Design : Your Next Unicorn iOS App
--
This article intends to give the testable start-off point for ios-devs trying to ship their very first app to App Store.
What : List of latest news to be pulled from news-api, parsed and shown as a list on home screen of the iOS app. App Code should be written in a way, making it mostly testable by writing unit test with XCTest framework.
How : I have used MVVM for structuring the code paired with unit tests written via XCTest.
High Level Design Code:
- HomeViewController : Class consisting of UI part of the app.
2. HomeViewModel: Class to provide all the data HomeViewContoller or view from models.
3. HomeAPIManager: Class to fetch news from news-api end points
4. News: Model for the News item from news-api response.
5. NewServices: Protocol to fetch news from news-api end points.
6. HomeViewModelDelegate: Delegate to send across info from ViewModel to HomeVC.
Test High Level Design :
- MockHomeAPIManager:
- MockHomeViewDelegateImplementation:
- HomeViewDeleegateTests:
Here is the GitHub link for the repo.
Follow me Rahul Goel for more updates.
Follow me Rahul Goel for regular updates.