LSAPI is a basic library which is convenient to build network request observer, based on Rxswift or Combine.
To integrate LSAPI into your Xcode project using Carthage, specify it in your Cartfile:
github "sandsn123/LSAPI"
NOTE: Please ensure that you have the latest Carthage installed.
LSAPI
: Basic interface service protocol libraryAlamofireExecutor
: On the basis of LSAPI, it uses alamofire to build the executor instance of request, You can customize other executor.RxService
: Rxswift + Alamofire
GetBookService().asObservable()
.subscribe(onNext: { result in
switch result {
case .success(let data):
print(data)
case .failure(let error):
print(error)
}
})
.disposed(by: self.disposeBag)
CbService
: Combine + Alamofire
self.cancellable = GetBookService().asPublisher()
.sink(receiveCompletion: { (completion) in
}) { (result) in
print(result)
}
//.store(in: &self.cancellableSet)
// Cancel the activity
self.cancellable?.cancel()