SwiftUI ScrollView performance in macOS 15

There seems to be a performance issue when scrolling using the track pad with SwiftUI scroll views in macOS 15. This issue is NOT present in macOS 14.

When using the track pad the scrolling is not smooth, but "stutters". However scrolling using the scroll bars is very smooth. The "stuttering" is worse if the SwiftUI ScrollView is in the detail view of a NavigationSplitView.

The problem is not noticeable in scroll views with a small number views, but when the more views inside the scroll view, the more prominent the problem becomes.

I have a simple example app that illustrates the problem here (the example app is a simplification of my app Yammixer): https://github.com/danwaltin/SwiftUIScrollViewPerformance

When running this example app on macOS 14 (Sonoma) on an Intel i7 Mac book pro from 2019 the scrolling is "buttery smooth".

But on macOS 15 (Sequoia) on my Apple Silicon M1 Mac book pro the issue is very obvious.

When using Instruments I see that on macOS 15 "flame graph" shows that 85% of the execution time is in a "_hitTestForEvent" method. If the test app does not use NavigationSplitView about 70% of execution time is in the _hitTestForEvent method.

Is there anyone else who has run into this issue? Or am I doing anything wrong?

I have exactly the same issue. The "_hitTestForEvent" method only takes 38,3 %, but the "_routeMouseMovedEvent" has 55,8 % (I am using the Magic Mouse instead of the touch pad).

For me it seems to be a bug in SwiftUI.

@ugglaguggla : Do you experience the same behaviour in the Xcode Preview? I only have the issue when using the compiled version.

I have tried to work around the problem by using the .onScrollVisibilityChange modifier to avoid render views that are not visible in the scrollview. The performance is improved a tiny bit, but it is still far from acceptable.

I am seeing exactly the same. I have a 'LazyVStack' enclosed in a 'ScrollView', in which I can be displaying thousands of elements. Definite slow down. I've pulled my code apart and still can't get an improvement.

Is this, per-chance, the very reason that scrolling is laggy in System Settings, Tips and Notification Centre in macOS Sequoia then? (All seem to be SwiftUI afaik and all of them had buttery smooth scrolling in macOS 14).

I'm having this same problem: Scrolling on macOS with the scroll bar is smooth, and very smooth on iOS, but jittery when scrolling with the trackpad or mouse scroll wheel on macOS.

I've been drilling into this problem on my app, which scrolled perfectly on Sonoma and now is barely usable on Sequoia. I'm seeing thousands of hitTest calls. By swizzling hitTest and counting how many times they occur between scroll events. The following is PER SCROLL EVENT

(or it might show two scroll ticks but still) To scroll this area

It takes a good 300ms to respond to my scroll wheel on my M3 Max.

What could these NSShapeHitTestingViews and NSGraphicsView and CGDrawingView calls be caused by?

If others are having problems like this, perhaps we will see a fix from Apple. But in the meantime, I can't release anything until I either rebuild my view hierarchy (I'm doing some stuff with ScrollView, GeometryReader and LazyVStack - I don't see the same problems if I put my elements in a SwiftUI List but that doesn't give me all the functionality I need.)

The feedback I filed for this issue (which I made sure included a direct link to this thread and it's information) was recently marked as "Potential fix identified - For a future OS update" so hopefully Apple ships said fix in one of the upcoming 15.2 beta builds. FB ID is FB15241636.

SwiftUI ScrollView performance in macOS 15
 
 
Q