首页 > 代码库 > 第五天 loadmore

第五天 loadmore

 

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

 

第五天 loadmore