.sheet takes seconds to open

Hey guys,

I'm having a performance problem with SwiftUI. In my main view I have a typical ScrollView with a VStack that contains rows of scrollable HStacks (pretty much like the 'For you' screen of the Photos app).
When the user clicks on one of the items displayed in the stacks a sheet should open. However, opening the sheet takes 2-3 seconds.
I have already run the app through instruments and there is no immediate performance issue within my code:
  • no new views are created within the 'View Body' row (except the one view used in the .sheet)

  • nothing in TimeProfile - all the heavy, time-consuming stuff shows to be system libraries

  • The CoreAnimation Commits row shows a lot of activity in AG::Subgraph::update

  • within the "View Properties" row I can also see a lot of activity within my main view (e.g. lots of calls like 'IdentityLink in SystmeContextMenuContainer updated from ...') starting the moment I try to open the .sheet. It seems like there is some hardcore CoreAnimation going on in the background - is this due to the fact that the main view is scaled down a little and animated to the background when showing a modal dialogue on iOS? However, I would expect iOS to just take a snapshot of the main view and not run through the entire rendering graph.

Two additional things I noticed:
  1. I get some performance improvements when I remove a .contextMenu ViewModifier I created and which I add to each item in the list.

  2. when using iOS14's .fullScreenCover instead of .sheet the modal opens without any delay


it's same problem. In the case for me, When i use iOS 18 less It's okey But I updated to iOS 18 more. .sheet takes seconds to open.

.sheet takes seconds to open
 
 
Q