Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catalyst track scrollWheel with NSApp.publisher(for: \.currentEvent) #22

Open
andriiicatmed opened this issue Oct 20, 2021 · 0 comments

Comments

@andriiicatmed
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant