Cannot call value of non-function type '[Observable<Event>.Type]'

121 views Asked by At

Xcode 15 Mac book M1

  • Moya/RxSwift (15.0.0):
    • Moya/Core
    • RxSwift (~> 6.0)

Cannot call value of non-function type '[Observable.Type]'

private func bindingsStrongify<Event, O, WeakOwner>(_ owner: WeakOwner, _ bindings: @escaping (WeakOwner, O) -> (Bindings<Event>))
    -> (O) -> (Bindings<Event>) where WeakOwner: AnyObject {
    return { [weak owner] state -> Bindings<Event> in
        guard let strongOwner = owner else {
            return Bindings(subscriptions: [], events: [Observable<Event>]())
        }
        return bindings(strongOwner, state)
    }
}

error image

@Maya https://github.com/Moya/Moya/issues/2325

1

There are 1 answers

0
Daniel T. On BEST ANSWER

The compiler is confusing the Swift.Observable type with the RxSwift.Observable type. Use: return Bindings(subscriptions: [], events: [RxSwift.Observable<Event>]()) instead.