gpt4 book ai didi

ios - 使用未声明的类型 'SignalProducerType

转载 作者:行者123 更新时间:2023-11-28 15:00:46 25 4
gpt4 key购买 nike

我是 ReactiveCocoa 和 ReactiveSwift 的新手,在更新代码后,我的任务是将代码从 Swift2 更新到 Swift4 我卡在了一个点,在那里我遇到了“使用未声明的类型‘SignalProducerType’”的错误,没有找到我们是否有其他选择?请帮我解决这个问题我正在使用 ReactiveCocoa 7.1.0

extension SignalProducerType where Value == HTTPOperationResult,Error == APIError {    func serializeToJSON() -> SignalProducer {        return attemptMap { result in            guard let data = result.data else {                return .failure(APIError.parseError("invalid json"))            }            guard let JSON = try? JSONSerialization.jsonObject(with: data, options: []) else {                return .failure(APIError.parseError("invalid json"))            }            return .success((result,JSON))        }    }}

最佳答案

SignalProducerType 不再存在。它已重命名为 SignalProducerProtocol,但不再用于添加运算符。 This ought to just be an extension on SignalProducer itself :

All Signal and SignalProducer operators now belongs to the respective concrete types. (#304)

Custom operators should extend the concrete types directly. SignalProtocol and SignalProducerProtocol should be used only for constraining associated types.

关于ios - 使用未声明的类型 'SignalProducerType,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48946646/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com