Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios RXSwift如何使用返回值为委托方法创建包装器_Ios_Swift_Uitableview_Rx Swift - Fatal编程技术网

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

Ios RXSwift如何使用返回值为委托方法创建包装器,ios,swift,uitableview,rx-swift,Ios,Swift,Uitableview,Rx Swift,我有一个RXSwift中代表的包装器 func tableView(tableView: UITableView,movedRowAtIndexPath sourceIndexPath: NSIndexPath,toIndexRowPath destinationRowIndexPath: NSIndexPath) 他们看起来像 public var rx_itemRowMoved: ControlEvent<ItemMovedEvent> { let source

我有一个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)
}

如何实现此委托的包装器?

没有办法。您可以直接在委托所有者中实现此方法。您还可以参考
RxTableViewReactiveArrayDataSource
CellFactory
。它会将方法更改为block

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