catch、tryCatch、retry 、tryRetry
操作符
功能描述
行为
适用场景
关键参数
详细说明:
示例用法
let publisher = Fail<Int, Error>(error: NSError(domain: "", code: -1, userInfo: nil))
let subscription = publisher
.catch { error in
Just(0) // 返回一个默认值
}
.sink(receiveCompletion: { print($0) }, receiveValue: { print($1) }) 总结
Last updated