mhdhejazi / Dynamic

Call hidden/private API in style! The Swift way.

Home Page:https://medium.com/@mhdhejazi/calling-ios-and-macos-hidden-api-in-style-1a924f244ad1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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