This app demonstrates the Fetching the list of closed pull request from GitHub with simple API call without Authorization. We need to use authorization provided by github inorder to overcome the "Rate limiting".
Todo that pls navigate to APIRouter and go to asURLRequest and add your github private user token to fetch the list
urlRequest.addValue("", forHTTPHeaderField: "Authorization")
I have used ALAMOFIRE to handle API Calls and Mapped JSON's to my CODABLE MODEL. All the codable models are tested with UNIT test with mock data. I have used SDWebImage to fetch the images
I have implemented this feature with MVVM architecture, Where the ViewController speaks to ViewModel and In ViewModel, we will communicate to Service . The service speaks to network manager and Network manager expects the URLRequest from the APIHandler. Once we get the data we map into respective models and converted to UIModels and Passed back data to Viewcontroller
The above api is a paginated api, The logic for pagination is, if the fetcheditems count is less than itemsPerBatch (i.e., 10) then we dont make a api call until then new page details will be fetched
if newItems.count < self.itemsPerBatch {
self.reachedEndOfItems = true
print("reached end of data. Batch count: \(newItems.count)")
}
self.page += 1
Since its a pagination api we need to show loader to the tableview, so we have created a loader and added it to the section 1 of tableview, so whenever we fetch a data in background, the loader happens in frontend
| First Fetch | Batch Request with Loader |
|---|---|
![]() |
![]() |
| ViewModel with MOCK Data | Model with Mock Data |
|---|---|
![]() |
![]() |



