I am trying to learn ReactiveCocoa and have a hard time getting started. I keep hitting minor bumps as API and tutorials seems to be outdated quickly. Maybe I have the wrong imp
If you add "import Results" to the top of the page above your class, NoError will no longer be an undeclared type!
If you are seeing this now with ReactiveSwift 6.0, they removed the dependency on Result, which removes NoError
.
Per their release notes here, the solution is to now use Never
.
- If you have used Result only as dependency of ReactiveSwift, remove all instances of import Result, import enum Result.NoError or import struct Result.AnyError and remove the Result Framework from your project.
- Replace all cases where NoError was used in a Signal or SignalProducer with Never
The following example code shows how this should look now:
import ReactiveSwift
func example() -> SignalProducer<Void, Never> {
return SignalProducer(value: ())
}
The reactive cocoa native NoError
was removed in 4.0.1 in favour of antitypicals implementation in Result
(adds NoError
to Result
, see this). See e.g. issue #2704
We can see this explicitly used in the source files, e.g.
import enum Result.NoError
in Property.swift.Hence, you probably need to include (antitypicals) Result
whenever you intend to use NoError
. One suggested fix in the issue thread is
public typealias NoError = Result.NoError