Member-only story

Interactive Widgets in SwiftUI

Bruno Lorenzo

--

Widgets are a great way to show users relevant information on their home screen.

Previous to iOS 17, we could only display static data. However, in WWDC23 Apple announced the possibility to add interactivity in widgets. This could be seen as an insignificant feature, but we can leverage it to allow our users to perform simple actions directly from the widget.

So, If you’re interested in improving your app’s engagement, here is how to use it.

We'll use a simple widget created for our Coffee Shop Demo App. The widget shows the last coffee the user ordered and a button to repeat the order.

The Widget

I'll not be going into details on how to create a Widget, but here's a simple guide.

If you already have your widget implemented, you can skip this section.

1. Add a Widget Extension Target

2. Define Widget's content

--

--

Responses (1)