Unfortunately I have not found a way.

I tried using the @SceneBuilder property to build a multi-scene view, but it doesn't work with if-else (for example, if user has not clicked a template, show the template view).

Generally, I think switching scenes isn't a good idea. They were meant to contain individual lifecycles, which doesn't make sense for document editing (why would you have one lifecycle for the template view and another for the document editor?).

However, I have noticed other questions similar to yours, and a solution may eventually be found.

https://stackoverflow.com/questions/62602271/let-user-pick-document-type-to-create-when-using-swiftui-documentgroup

https://developer.apple.com/forums/thread/651667

Remember that SwiftUI 2 is still in beta and that new functionality is being added constantly.

I like reading manga and writing about Swift. Check out my app, Find — search text in real life! apple.co/3jFUFvt

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store