This code also works well for iPad. You may miss the configuration in Xcode.
In Xcode -> general -> development info, you have to check only "iPad", choose "portrait" and "landscape left(right)", and check "requires full screen". Then, you can do well, I think.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: