Build Your First iOS Widget — Part 2

Different widget sizes and deep links

Ale Patrón
The Startup

--

Note: This is part 2 of a 3-part tutorial. Make sure to complete part 1 before continuing with this article. You can find part 3 here.

Small, medium, and large widgets.

Widgets on iOS can support 3 different sizes: small, medium, and large. In part 1 of this tutorial, we only added support for small widgets. Now we will add a medium widget and a large widget as well.

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

Supporting Different Widget Sizes

Open up the Emojibook project on Xcode and navigate to the Emojibook_Widget.swift file. To support different widget sizes, all we have to do is modify the arguments in the supportedFamilies modifier of the Emojibook_Widget struct. So go ahead and add .systemMedium and .systemLarge to the list of supported families.

Now, run your app making sure the Emojibook WidgetExtension is the active scheme, and go into jiggle mode. Press the “+” button on the top left corner and select the…

--

--