ios – RxSwift Kind of expression is ambiguous with out extra context

[ad_1]

I am going through this situation whereas attempting to nest 2 community API utilizing RxSwift, the flatMap retains saying kind of expression is ambiguous. I am new to RxSwift so this takes me virtually 2 days however no clues. I attempted to declare each factor specific however not serving to.
enter image description here

I am unsure why it did not know the return kind of the closure.
Right here is full code:

non-public func uploadImage(imageUrl: URL) -> Observable<String> {
    do {
        let knowledge = attempt Information(contentsOf: imageUrl)
        let fileExtension = imageUrl.pathExtension
        return Single<String>.create(subscribe: { single in
            AppManager.shared.dataAdapter.apiCallUploadDocument(knowledge: knowledge, fileExtension: fileExtension) { end in
                swap end result {
                case .success(let documentId):
                    single(.success(documentId))
                case .failure(let error):
                    single(.failure(error))
                }
            }
            return Disposables.create()
        }).asObservable()
    } catch let error {
        return Observable.error(error)
    }
}

func subscribePlan(knowledge: SCSubscribeData) -> Observable<PurchaseResponse> {
    let settings = AppManager.shared
    let idCardPhoto = knowledge.idCardPhoto
    let governmentPassportPhoto = knowledge.governmentPasspordIdPhoto
    let isUserProfileUpdated = settings.loginResult.profileUpdated
    if isUserProfileUpdated {
        let icDocumentType = settings.eligibilityInput.getSubscriberData()["idType"] ?? ""
        return uploadImage(imageUrl: idCardPhoto.url)
            .flatMap({ documentId in
                let param: [String: String] = [
                    "eligibilityDocument": documentId,
                    "icDocument": "EXISTED",
                    "icDocumentType": icDocumentType,
                    "eligibilityDocumentNo": data.idNumber,
                ]
                let scAdditionalParameter: [String : AnyObject] = [
                    "properties": param
                ]
                return subscribe(purchaseModel: knowledge.purchaseModel, additionalParam: scAdditionalParameter)
            })
        
    }
    return Observable<PurchaseResponse>.error(NSError())
}

func subscribe(purchaseModel: PurchaseModel, additionalParam: [String: AnyObject]) -> Observable<PurchaseResponse> {
    return Single.create(subscribe: { single in
        AppManager.shared.dataAdapter.apiCallPurchaseSubscription(purchaseModel: purchaseModel,
                                                         additionalParameter: additionalParam,
                                                         end result: { end in
            swap end result {
            case .success(let res):
                single(.success(res))
            case .failure(let error):
                single(.failure(error))
            }
        })
        return Disposables.create()
    }).asObservable()
}

[ad_2]

Leave a Reply