2016-01-27 9 views
6

Ho un wrapper per delegato in RXSwiftRXSwift Come creare wrapper per il metodo delegato con valore di ritorno

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

E sembra

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) 
} 

Ma ho delegato con valore di ritorno

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

come posso implementare il wrapper per questo delegato?

risposta

3

Non c'è modo di farlo. È possibile implementare questo metodo direttamente nel proprio proprietario delegato. È anche possibile fare riferimento a CellFactory di RxTableViewReactiveArrayDataSource. Cambia il metodo da bloccare.