Мне нужно выбрать конкретный c элемент в моем табличном представлении при использовании метода modelSelected () .
Когда я реализовал itemSelected () метод я смог выбрать элемент, используя index.row
self.quickLookController.currentPreviewItemIndex = index.row
Я не знаю, как получить currentPreviewItemIndex моего табличного представления. Когда я выбираю его, отображается сообщение о том, что данные недоступны.
_ = documentTableView.rx.modelSelected(Structured.self).subscribe(onNext: { structured in
if structured is Document {
// self.quickLookController.currentPreviewItemIndex = ...
self.parent?.navigationController?.show(self.quickLookController, sender: self)
}
if structured is Structure {
let structure = structured as! Structure
let sb = UIStoryboard(name: "Main", bundle: nil)
let documentViewCtrl = sb.instantiateViewController(withIdentifier: "DocumentListViewController") as! DocumentListViewController
self.treeSource?.select(structure)
documentViewCtrl.treeSource = self.treeSource
documentViewCtrl.navigationItem.title = structure.name
self.navigationController?.pushViewController(documentViewCtrl, animated: true)
}
})