mutating func loadFresh(completion: (result: APIResult<DeserializedType>) -> ()) -> CancellableToken { self.currentPage = 1 // self.isNoMoreData = false return self.doRequest() { result in if case .Success(let entities) = result { if entities.isEmpty { // self.isNoMoreData = true } else { self.currentPage += 1 } } completion(result: result) } } mutating func loadMore(completion: (result: APIResult<DeserializedType>) -> ()) -> CancellableToken { // self.isNoMoreData = false return self.doRequest() { result in if case .Success(let entities) = result { if entities.isEmpty { // self.isNoMoreData = true } else { self.currentPage += 1 } } completion(result: result) } }
https://www.github.com/MengTo/DesignerNewsApp/