RXSwift如何使用返回值为委托方法创建包装器

时间:2016-01-27 14:50:25

标签: ios swift uitableview rx-swift

我在RXSwift中有一个委托包装器

func tableView(tableView: UITableView,movedRowAtIndexPath sourceIndexPath: NSIndexPath,toIndexRowPath destinationRowIndexPath: NSIndexPath)    

他们看起来像

public var rx_itemRowMoved: ControlEvent<ItemMovedEvent> {
    let source: Observable<ItemMovedEvent> = rx_delegate.observe("tableView:movedRowAtIndexPath:toIndexRowPath:")
        .map { a in
            return ((a[1] as! NSIndexPath), (a[2] as! NSIndexPath))
    }

    return ControlEvent(events: source)
}

但我有代表返回值

 func selectionViewForTableView(tableView: UITableView,destinitionCell cell:UITableViewCell,toIndexRowPath destinationRowIndexPath: NSIndexPath) -> UIView

我如何为这个委托实现包装?

1 个答案:

答案 0 :(得分:3)

没有办法做到这一点。您可以直接在代理所有者中实现此方法。您也可以参考CellFactory的{​​{1}}。它将方法更改为阻止。

相关问题