Getting “use of undeclared type 'NoError'” with ReactiveCocoa

后端 未结 3 800
情深已故
情深已故 2021-02-05 16:12

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

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-05 16:45

    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 {
        return SignalProducer(value: ())
    }
    

提交回复
热议问题