Build Your First iOS Widget — Part 3

Making a user-configurable widget with SiriKit

Ale Patrón
The Startup

--

Note: This is the third and final part of my 3-part widget tutorial. Make sure to complete part 1 and part 2 before continuing with this article.

User-configurable widget.

Note: You’ll need Xcode 12 Beta 2 or higher to follow this tutorial.

So far, we have created a simple list-based app that displays different emoji along with their names, and allows you to view details about a specific emoji by tapping on it. Furthermore, we created a widget for our app–which can be small, medium, or large–and will display an emoji that is updated randomly every hour.

In this final part of the tutorial, we will use SiriKit to add a new widget that the user can configure to display an emoji of their choice.

User-Configurable Widgets

In some cases, we may want an app widget to display content chosen by the user. For example, a stock market app may let users choose a specific stock to display on a widget. Let’s go ahead and write some code to support adding a widget that displays an emoji of your choice.

Intent Definition

To get started, we first need to create a custom intent definition; this is what will allow us to define customizable…

--

--