QuickLook sheet not opening in iOS

I'm developing an application in which saving files and opening them with .quickLookis in important role.

However, after putting my application to TestFlight and letting a friend of mine test it with his phone (iOS 17.4.1, iPhone 15 Pro) it appears that sometimes when opening a file the QuickLook sheet doesn't open until the app's focus is lost.

@State 
Button("Open file") {
    url = someFileUrl
}.quickLookPreview($url)
Answered by toke0 in 795309022

It appears that in the original application the .quickLookPreview call was placed too low in the view hierarchy, and moving it to the parent fixed the issue

fix:

@State
...

to

@State private var url: URL? = nil
Accepted Answer

It appears that in the original application the .quickLookPreview call was placed too low in the view hierarchy, and moving it to the parent fixed the issue

QuickLook sheet not opening in iOS
 
 
Q