我发现你可以使用introspect API和.preferedCornerRadius来实现它。然而,文档确实警告说这可能会在未来出现问题。
将此添加到传递给sheet的视图中。
Import Introspection
.introspectionViewController { vc in vc.sheetPresentationController?.preferredCornerRadius = 20 }
值得一提的是,我决定构建具有圆角的自定义模态窗口,以便能够纯粹地使用SwiftUI。