Andrew Zheng
1 min readJul 9, 2020

--

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.

--

--

Andrew Zheng
Andrew Zheng

Written by Andrew Zheng

WWDC21 Scholar. I like to read manga and write about Swift. Check out my app, Find — look for text in real life, with outrageous speed. getfind.app

No responses yet