This UIKit application demonstrates that a SwiftUI view which is presented modally within a UIHostingController cannot be dismissed programmatically on iOS 14 and older devices.
This problem is particularly severe in landspace orientation because the modal takes up the full screen and cannot be dismissed by swiping down, as demonstrated below:
The issue was resolved in iOS 15. If you need present a SwiftUI view within a UIHostingController, you're best setting your target's IPHONEOS_DEPLOYMENT_TARGET
Build Setting to 15.0
or higher.