0
votes

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))
        }
    }
}
1
include your code.. your description of the problem is like super vague..Milan Nosáľ
edited my questionVinay
well, ovbiously SignalProducerType is not a recognized type.. do you have that class somewhere?Milan Nosáľ
No i don't have that classVinay
you must have broken either something in linking/importing React, or there have been a change to API that renamed SignalProducerType..Milan Nosáľ

1 Answers

1
votes

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.