4 ms·
Not really. On macOS, trackpad swipes produce a series of horizontal scroll events, not a simple back/forward event. An app can do whatever it wants with the sc
by KerrAvon 5y ago
Not really. On macOS, trackpad swipes produce a series of horizontal scroll events, not a simple back/forward event. An app can do whatever it wants with the scroll events. Safari, when the scroll position is at the end of the horizontal outer edge of the document, does an interactive back/forward animation that tracks your fingers while they remain on the trackpad.
- tinus_hn 5y agoAs far as I know you’re supposed to use the NSGestureRecognizer system to recognize this kind of gestures and it’ll automatically make it work like you write. If you try to handle all the events yourself you end up doing a lot of work for probably a worse result.
- jb1991 5y agoYou are correct.
- jb1991 5y ago> On macOS, trackpad swipes produce a series of horizontal scroll events, not a simple back/forward event. That's not true. On macOS (and also iOS), you subscribe to gesture recognizers (i.e. swipe gestures), not isolated events, which give you easy access to how users interact with macOS without having to analyze (and likely analyze incorrectly) low-level trackpad interaction. You could always choose to look directly at events instead, but if you are trying to get the behavior of a widely-used gesture like swiping forward/back, you will get much more accuracy (and happiness from users, and less dev time) by just recognizing them at a high level, which is what Apple expects.