0

I have a reactive method who should return ((Void) throws -> Void)? to be used into .on(onNext: myUIComponent.rx.function) but no matters what I do I never get what is expected.

I was tries

func name() throws -> Void?

func name(xpto: ((Void) throws -> Void?) = nil)

Someone have some idea?

2 Answers2

2

Have you tried

func name(xpto: ((Void) throws -> Void)? = nil)

(? outside of the parenthesis.) That makes the whole closure optional, rather than an optional that returns a void optional, which doesn't make sense.

Duncan C
  • 128,072
  • 22
  • 173
  • 272
0

D'oh, nothing is necessary, just create a func name() without return like

extension Reactive where Base: ReactiveUIComponent {
    func name() {
        ...
    }
}

button.rx.tap
    .do(onNext: reactiveUIComponent.rx.name)
    ...