0

I am new to ReactiveCocoa and ReactiveSwift, I am having task of update code from Swift2 to Swift4 after updating code i stuck in one point where I encountered error for "Use of undeclared type 'SignalProducerType'" not found do we have any alternative for this ? Please help me in resolving this issue i am using 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))
        }
    }
}
MeXx
  • 3,357
  • 24
  • 39
Vinay
  • 171
  • 1
  • 7

1 Answers1

1

SignalProducerType no longer exists. It was renamed to SignalProducerProtocol, but it isn't used to add operators anymore. 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.

Community
  • 1
  • 1
jjoelson
  • 5,771
  • 5
  • 31
  • 51