无法在RxSwift中的CombineLatest中使用类型为((@@ scaping(_)-> _))的参数列表调用'filter'

我正在尝试从试图合并的两个流中过滤掉某些内容。我要尝试的两个值属于同一类型,因此我似乎无法理解为什么遇到此问题。

 let currentUserEmail = Observable.just(currentUserEmail)
            .unwrap()

//使用一些内部方法来访问电子邮件

let listOfAllUsers = Observable.combineLatest(getUsersList(),currentUserEmail) { allUsers,currentUserEmailaddress in
        return allUsers.filter { $0.emailaddress != currentUserEmailaddress } }
    .asObservable()
    .share(replay: 1,scope: .whileConnected)
lxy1195 回答:无法在RxSwift中的CombineLatest中使用类型为((@@ scaping(_)-> _))的参数列表调用'filter'

let currentUserEmail = currentUserEmail

let listOfAllUsers = getUsersList()
       .asObservable()
       .share(replay: 1,scope: .whileConnected)

let newListOfAllUsersWithoutCurrentUser = listOfAllUsers.map { allUsers in
             allUsers.filter { $0.emailAddress != currentUserEmail }
         }
         .share(replay: 1,scope: .whileConnected)

这最终对我有用。

本文链接:https://www.f2er.com/2723900.html

大家都在问