can’t seem to limit and offset a pastebin URL what should I be looking into to resolve this?
want to load n items, and load more from the API when the user reaches the end of the collection view (via scrollViewDidScroll /willDisplay); below is my interactor:
at this point, thinking of just splitting the json data into chunks before parsing
import UIKit
import SwiftyJSON
class PhotoInteractor: NSObject {
func fetchPhotos(completionHandler: @escaping (([Photo], Error?) -> Void)) {
let url = URL(staticString: "https://pastebin.com/raw/wgkJgazE")
URLSession.shared.dataTask(with: url) { (data, response, error) in
if let error = error {
completionHandler([], error)
return
}
if let data = data {
if let jsonData: JSON = try? JSON(data: data) {
completionHandler(Photo.parsePhotos(data: jsonData), nil)
}
}
}.resume()
}
}