HHPGNetWork
安装
pod 'HHPGNetWork'
使用说明
基础配置
PGSpiManager.config.setConfig(baseUrls: ["https://api.apiopen.top"],
result_key: PGSpiRegKey(code: "code",
msg: "message",
data: "data1",
success: 200))
RxSwift 请求
_ = PGSpi(Common.getAllRegion).rxSend().mapSpiObjects(to: AppInfo.self).subscribe(onSuccess: { (value) in
print(value.count)
print(value[0].toJSONString())
}) { (error) in
print(error.localizedDescription)
}.disposed(by: disposeBag)
流请求
PGSpi(Common.getAllRegion).send { (response) in
switch response.result {
case .success(let value):
do {
let repos = try value.mapJSON()
} catch(let error) {
print(error.localizedDescription)
}
case .failure(let error):
print(error.handle().message)
}
}
作者
开源协议
本项目基于 MIT 协议,请自由地享受和参与开源。