Are you seeing a weird change in text and image styles when you dismiss a SwiftUI popover?

Development / iOS / Making of Captionista

Another one from the “building Captionista” files, I noticed that on iPad any Text inside a popover that has no explicit font will change weight/size when the popover is dismissed, also affecting the layout. You only see it briefly when you tap away from the popover, but it looks bad!

Note that the same problem applies to imageScale so it looks like there is something in the environment that changes when the popover dismiss begins.

Workaround: Add .font(.body) or similar on the elements so you’re not relying on any defaults in the View hierarchy.

The Author

Marc Palmer (Threads, 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 screenshot framing and backgrounds app Shareshot and video subtitling app Captionista. He created the Flint open source framework that people liked the idea of but nobody uses. You can find out more here.