簡體   English   中英

RxSwift:對成員'items(cellIdentifier:cellType :)'的不明確引用

[英]RxSwift: Ambiguous reference to member 'items(cellIdentifier:cellType:)'

我想設置tableView數據源與結合RxSwift (3.6.1)但構建應用程序時,我得到一個錯誤:

對成員'items(cellIdentifier:cellType :)'的引用不明確

這里只是來自Array的簡單Observable,僅用於測試:

這里只是來自<code> Array <Int> </ code>的簡單<code> Observable </ code>,僅用於測試

PS viewController的tableView連接到情節提要中

您在){之間錯過了一點)

正確的代碼應為:

    let test = Observable.just([1, 2, 3, 4, 5]).bind(to: tableView.rx.items(cellIdentifier: "pokatushkaCell")) {
//                                              ^
        row, item, cell in
    }

注意箭頭所指的位置。 您錯過了) ,使Swift認為您要調用帶有兩個參數的items

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM