ReactiveCocoa / ReactiveCocoa

Cocoa framework and Obj-C dynamism bindings for ReactiveSwift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

proxy.invoked of NSControl should be exposed

cxa opened this issue · comments

In UIKit, if you don't want to use CocoaAction (it is complex and verbose for simple task), it's possible with reactive.controlEvents(_ controlEvents: UIControl.Event) e.g.

downloadButton.reactive.controlEvents(.primaryActionTriggered).observeValues { _ in 
  dispatcher.send(event: .handleDownload) 
}

but is impossible for AppKit because you hide the proxy.invoked for NSControl.

So I think it's better to expose proxy.invoked, and rename it to a more sensable API name if necessary.

We could expose it as NSControl.reactive.triggered. That's said NSButton has a states signal which should serve your use case. Is that not suitable?

Hello. 👋 Thanks for opening this issue. Due to inactivity, we will soft close the issue. If you feel that it should remain open, please let us know. 😄