Catalyst track scrollWheel with NSApp.publisher(for: \.currentEvent)
andriiicatmed opened this issue · comments
This is the code I use for tracking scrollWheel:
NSApp.publisher(for: \.currentEvent)
.filter { event in event?.type == .scrollWheel }
.throttle(for: .milliseconds(1), scheduler: DispatchQueue.main, latest: true)
.sink { event in
guard let event = event else {
return
}
}
.store(in: &bag)
for catalyst I've tried smth like that:
Dynamic.NSApp.publisher(for: \Dynamic.NSApplication.currentEvent).sink { v in
gives error Segmentation fault: 11
or like that:
Dynamic.NSApp.publisher(for: \NSApplication.currentEvent).sink { v in
gives 'currentEvent' is unavailable in Mac Catalyst