get next page's item in iOS (SWIFT)

how can i do the same in iOS ???

    public class MyForm { final DataHandler dataHandler; BackendlessCollection<Note> data;

    MyForm() {
    dataHandler = new DataHandler(this);
    }

    void setData(BackendlessCollection<Note> data) {
    this.data = data;
    //render new set of data
    }

    //‘Fetch Data’ Button click handler
    public void fetchData() {
    BackendlessDataQuery dataQuery = new BackendlessDataQuery();
    dataQuery.setPageSize(10);

    Backendless.Data.of(Note.class).find(dataQuery, dataHandler);
    }

    //‘Next Page’ Button click handler
    public void fetchNext() {
    data.nextPage(dataHandler);
    }

    void setError(BackendlessFault fault) {
    //swipeToReload.setRefreshing(false);
    //Toast.makeText(getContext(), “” + fault.getMessage(), Toast.LENGTH_LONG).show();
    }

    class DataHandler implements AsyncCallback<BackendlessCollection<Note>> {
    final MyForm form;

    DataHandler(MyForm form) {
    this.form = form;
    }

    public void handleResponse(BackendlessCollection<Note> notes) {
    form.setData(notes);
    }

    public void handleFault(BackendlessFault fault) {
    form.setError(fault);
    }
    }
    }
    the above code is from android platform and i want to do the same in swift , am not able to find the classes which i used in my android , like i dont what is DataHandler in iOS its no where in entire backendless class…

well it was easy than i expected it to be , just wanted to know if is it a correct way of doing this or not thats why am posting my solution here :

this is my first fetch action
var fetchResults = BackendlessCollection()

func queryNotesFromServer(){

let dataQuery = BackendlessDataQuery()
dataQuery.whereClause = whereClause
let dataStore = backendless.data.of(Note.ofClass())
dataQuery.queryOptions.pageSize(5)

dataStore.find(dataQuery,

response: { (result: BackendlessCollection!) -> Void in
let notes = result.getCurrentPage()

//handle here first loaded page
self.fetchResults = result

},
error: { (fault: Fault!) -> Void in
print(“Server reported an error: (fault)”)
})
}

and after that my further fetch request’s action : which is loading 5 items per request
func loadNextPage(){

fetchResults.nextPageAsync({ (nextResult : BackendlessCollection!) in

let notes = nextResult.getCurrentPage()

//handle here next loaded page
self.fetchResults = nextResult

if self.fetchResults.getCurrentPage().count < 5 {

self.activityIndicator.stopAnimating()
}

})
{ (error : Fault!) in

print(“Server reported an error: (error)”)
}

}

please do let me know if its the correct way or not for achieving the paged data retrieval

Please see this sample in our BlogFeatureDay project.

You also could investigate these doc chapters: