How to Add Custom Popovers to Your iOS App

<p>There are currently 3 ways to present popovers. One is with&nbsp;<code>UIPopoverPresentationController</code>&nbsp;, but that only works on iPad. You could also present a&nbsp;<code>UIMenu</code>&nbsp;, but that&rsquo;s only for iOS 14+. Finally, you could use&nbsp;<code>UIAlertController</code>. This is probably the easiest to implement &mdash; but also the most limiting, since it supports only labels, buttons, and text fields.</p> <p>So&hellip; what if you need an in-app notification? A picture-in-picture video? Or an onboarding popup? This is where&nbsp;<em>custom</em>&nbsp;popovers come in.</p> <p><img alt="" src="https://miro.medium.com/v2/resize:fit:700/1*qKjR2QfNmx0bkMXsrXdoRw.png" style="height:420px; width:700px" /></p> <p>We&rsquo;ll be using the&nbsp;<a href="https://github.com/aheze/Popovers" rel="noopener ugc nofollow" target="_blank">Popovers</a>&nbsp;library. Full disclosure: I&rsquo;m the developer of this. But it&rsquo;s 100% open source and under the&nbsp;<a href="https://github.com/aheze/Popovers/blob/main/LICENSE" rel="noopener ugc nofollow" target="_blank">MIT license</a>, so feel free to use it however you want.</p> <p><a href="https://betterprogramming.pub/how-to-add-custom-popovers-to-your-swiftui-ios-app-814bdfad73d0"><strong>Read More</strong></a></p>
Tags: Popovers iOS