Sheets in SwiftUI on iPhone do not make the presenting view shrink behind

Development / iOS / Making of Captionista
Screenshot of modal sheet on iOS not shrinking the view behind

After solving the problem with SwiftUI adaptive popovers on iPad not dismissing properly on iPhone or in compact split view on iPad in Captionista, I noticed something…

If you show a modal sheet on iPhone, if you look closely you can see that the view behind does not shrink backwards as it would with a native UIKit modal presentation since iOS 13.

Screenshot of modal sheet on iPhone not shrinking view behind

Epic sad face.

Workaround: Use some mechanism to have your SwiftUI present the sheet using UIKit modal presentation of a separate UIHostingController instead. Or don’t worry too much and wait for this to be fixed.

The Author

Marc Palmer (Twitter, Mastodon) is a consultant and software engineer specialising in Apple platforms. He currently works on the iOS team of Concepts sketching app, as well as his own apps like video subtitle app Captionista. He created the Flint open source framework. He can also do a pretty good job of designing app products. Don't ask him to draw anything, because that's really embarrassing. You can find out more here.