SwiftUI: How to force a view presented in landscape mode?

I try UIDevice, but occurred error :

let value = UIInterfaceOrientation.landscapeRight.rawValue
UIDevice.current.setValue(value, forKey: "orientation")

error:

2021-08-23 11:54:05.514193+0800 Spider-IOS[5696:1212060] [error] precondition failure: setting value during update: 805944
dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
AttributeGraph precondition failure: setting value during update: 805944.
SwiftUI: How to force a view presented in landscape mode?
 
 
Q