swiftmayarx-swiftmaya-api

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


Xcode 15 Mac book M1

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


Solution

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