Member-only story

How to Create Configurable Widgets With Static Options?

Lee Kah Seng
7 min readFeb 14, 2023

--

This article is originally published at swiftsenpai.com

The main idea of widgets is all about giving users quick and easy access to the information that is most relevant to them. To bring this idea to the next level, we can make a widget configurable, which allows users to select what data is displayed and how it’s shown on the widget.

When it comes to the widget’s configurable items, we can classify them into two categories:

  • Static options: The configurable items are static and can be generated during development time, such as a static list of colors.
  • Dynamic options: The configurable items might vary or are generated dynamically during runtime, such as a list of countries provided by a remote server.

In this article, we will be focusing on configurable widgets with static options. You will learn how to set up a configuration intent, implement the intent timeline provider and configure a configurable widget. There’s a lot of ground to cover. Let’s dive in.

The MyText Widget

To keep things as simple as possible while effectively showcasing how to create a configurable widget, I will use this widget I created specifically for this article.

--

--

Lee Kah Seng
Lee Kah Seng

Written by Lee Kah Seng

Support me by becoming a Medium member: https://leekahseng.medium.com/membership ⦿ 🇲🇾 Creator of https://swiftsenpai.com ⦿ iOS developer since 2011

No responses yet