In SwiftUI I want to dismiss three sheet views and go back to the first root view, I find this solution in UIKit:
UIApplication.shared.windows.first?.rootViewController?.dismiss(animated: true)
It works fine but I get this warning:
'windows' was deprecated in iOS 15.0: Use UIWindowScene.windows on a relevant window scene instead
How can I get rid of this warning?