Member-only story
How to Add Custom Popovers to Your iOS Appđź”—
Break past system limitations with SwiftUI
There are currently 3 ways to present popovers. One is with UIPopoverPresentationController
, but that only works on iPad. You could also present a UIMenu
, but that’s only for iOS 14+. Finally, you could use UIAlertController
. This is probably the easiest to implement — but also the most limiting, since it supports only labels, buttons, and text fields.
So… what if you need an in-app notification? A picture-in-picture video? Or an onboarding popup? This is where custom popovers come in.
We’ll be using the Popovers library. Full disclosure: I’m the developer of this. But it’s 100% open source and under the MIT license, so feel free to use it however you want.
First, you’ll need to add the library to your project. Popovers supports Swift Package Manager — in Xcode, just go to File
→ Add
…