SwiftUI Popover replaces existing popover without moving it or pointing it at the correct view

Development / iOS / Making of Captionista

While building our new subtitling app Captionista we changed the UI to have a couple of buttons in the navigation bar that show popups on iPad.

I hit another fun bug with Popovers in SwiftUI: if you have multiple UI elements that can show a popover, if the user does not dismiss the previous popover, the next one will be shown in the previously active popover.

Unfortunately SwiftUI replaces the previous popover content but does not move the popover on iPad to point at the correct UI element, which is very bad.

Workaround: None that I know of yet.

There’s a feedback: FB8889229 “With SwiftUI, opening a new popover on iPad when the previous is still active, replaces the content of the old popover”

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.