Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Limiting API results for JSON prefetching

I'm practicing on getting results from an API and using the new prefetch protocol for UITableView. Using this API (https://jsonplaceholder.typicode.com/comments), I get around 500 comments. Is there a way to get only say 50 at a time? So I can then use the prefetch protocol to get the next 50 and so on and so forth. The situation is to have a tableView show these comments but it wouldn't be a good user experience to load all 500 comments at the same time. It would be better practice to load say 30-50 comments then retrieve more as the user scrolls down the tableView (or so I think). Is there a way to hard code the URL to filter the amount of posts or should I get all 500 comments then do something else to load them on the tableView or is there another approach? Any feedback is appreciated. Thanks.

Comments