第五天 loadmore

 

        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/

posted @ 2016-10-06 00:14  lianhuaren  阅读(122)  评论(0编辑  收藏  举报