UIKit app for displaying Github Users
The project depends upon two external libraries integrated via Swift Package Manager
SkeletonView - Displays shimmering effect for loading. Reachability - To monitor network status
- Code must be done in Swift 5.1. using Xcode 12.x, target iOS13 - Written in Swift 5.1 with iOS 13.0 as the minimum deployment target.
- CoreData must be used for data persisting - the
PersistanceManagerclass uses CoreData to persist API call data. - UI must be done with UIKit using AutoLayout - Both the user list page and user details page are done using AutoLayout.
- All network calls must be queued and limited to 1 request at a time. - Network calls are queued and limited to 1 request using OperationQueue in the
NetworkOperationsManagerclass - All media has to be cached on disk. - Image caching to memory, disk is managed by
ImageCacheServiceandImagePersistanceManagerclasses respectively - For GitHub API requests, for image loading & caching and for CoreData integration only Apple's APIs are allowed (no 3rd party libraries). -
NetworkOperationsManageruses URLSession to make the api calls and image loading,PersistanceManageruses apples core data library directly,ImagePersistanceManageruses file manager to save and retrive image data from disk. - Use Codable to inflate models fetched from api. -
JSONResponseDecoderusesJSONDecoderto decode the api data to the codable modelsUsersListResponseandUserDetailsResponse. - Write Unit tests using XCTest library for data processing logic & models, CoreData models (validate creation & update). - Unit test for creation, update for the persistance service class have been added, test cases for the repository class that handle network request and cached data fetch from persistence have been added, only limited test cases have been written for view models due to time constraints.
- If functional programming approach is used then only Combine is permitted (instead of e.g. ReactiveSwift). - Combine is used by the view models(
UsersListViewModel,UserDetailsViewModelandUsersListCellViewModel) for allowing the views to subscribe to value changes for updating the UI.
- The app has to be able to work offline if data has been previously loaded. - The app initially loads the content if present from persistent storage and then load the data from api.
- The app must handle no internet scenario, show appropriate UI indicators. - Offline banners are displayed in both the user list page and user details page.
- The app must automatically retry loading data once the connection is available. - Using the reachability library both the user list page and user details page are reloaded when the internet is available again.
- When there is data available (saved in the database) from previous launches, that data should be displayed first, then (in parallel) new data should be fetched from the backend. The app initially loads the content if present from persistent storage and then load the data from api.
- Empty views such as list items (while data is still loading) should have Loading Shimmer aka Skeletons. - Implemented using third party library SkeletonView
- Exponential backoff must be used when trying to reload the data. - Implemented in the class
NetworkDataServiceunder the methodrequestWithRetry - Any data fetch should utilize Result types. - All data fetch methods return result type
- CoreData stack implementation must use two managed contexts - 1.main context to be used for reading data and feeding into UI 2. write (background) context - that is used for writing data. -
viewContextis used for fetching data used for rendering the view,backgroundContextis used for saving new data and updating new data - All CoreData write queries must be queued while allowing one concurrent query at any time. - The
backgroundContextis created using the core data persistence container methodnewBackgroundContext()this method creates a new background context in which the queries are executed based on the FIFO method. - Coordinator and/or MVVM patterns are used. - Both coordinator and MVVM patterns are used.
- Users list UI must be done in code and Profile - with Interface Builder. - User List and its children are done in code and the profile page is done using interface builder
- Items in the users list are greyed out a bit for seen profiles (seen status being saved to DB). - Viewed users list cell is greyed out.
- The app has to support dark mode. - Supports dark mode.