Product10/17/2026·6 min read

How to Build a Custom iPhone Widget From Scratch

An iPhone widget is a snapshot that gets about 40 to 70 refreshes a day, not a tiny app. Build a custom one in order: data, size, layout, empty states.

To build a custom iPhone widget from scratch, work in a fixed order: decide the one piece of information it must show, pick the smallest size that holds it, lay it out inside Apple's 16-point margins, and design what it shows before its data arrives. A widget is not a small app. iOS renders it as a snapshot and, by Apple's own figures, refreshes a frequently viewed widget only 40 to 70 times a day, so every design choice has to survive data that is slightly old.

What is an iPhone widget, technically?

An iPhone widget is a sequence of pre-rendered snapshots, not a running program. Its code supplies a timeline of entries, WidgetKit renders the SwiftUI views for each entry in a separate process, and the system displays the stored result when each entry's date comes round, as Apple describes in Keeping a widget up to date. Between reloads, none of the widget's code runs.

Reloads come out of a budget. Apple says a widget someone views often typically gets 40 to 70 refreshes per 24 hours, roughly one every 15 to 60 minutes, and every widget instance you place has its own budget. Some reloads cost nothing: while the widget's app is in the foreground, when a button in the widget performs an action, and when the system locale or text size changes. A widget on a Home Screen page you rarely open may be reloaded less often.

Two design rules follow. Anything that should move faster than every quarter of an hour needs to be a date the system draws by itself, such as a countdown or "12 minutes ago", which SwiftUI keeps updating on screen without a reload (displaying dynamic dates); anything else will lag. And because the widget will often show data that is a little old, it should say how old.

Which sizes can a widget take on iPhone?

A widget takes one of the fixed families iOS defines, and the exact point size depends on the iPhone's screen. The ranges below come from the specification tables in Apple's Human Interface Guidelines for widgets, which list every supported screen size.

FamilySize on iPhone (points)Where it appearsButtons and toggles
Small141×141 to 170×170Home Screen, Today View, StandBy, CarPlayYes
Medium292×141 to 364×170Home Screen, Today ViewYes
Large292×311 to 364×382Home Screen, Today ViewYes
Lock Screen circular68×68 to 76×76Lock Screen, below the clockYes
Lock Screen rectangular153×68 to 172×76Lock Screen, below the clockYes
Lock Screen inline225×26 to 257×26Lock Screen, above the clockNo, a single tap target

iOS 27 adds an extra-large Home Screen size on iPhone, according to Apple's What's new in iOS 27, but only for apps that offer it; Apple's Home Screen customization help notes that some apps provide just small and medium. StandBy shows the small family scaled up with its background removed. The Lock Screen draws accessory widgets in a desaturated, vibrant style that adapts to the wallpaper, so a full-color Lock Screen design is not possible.

What can't a widget do?

A widget cannot scroll, play video or accept typing. Apple's list of SwiftUI views that work in widgets covers stacks, grids, text, images, shapes, gradients and a few others, with no scroll view, no text field and no video player, and it rules out UIKit views wrapped for SwiftUI.

Interaction is limited to buttons and toggles. Since iOS 17 they run an App Intent, an action the app exposes to the system, without opening the app, and a tap anywhere else launches the app (adding interactivity to widgets). On a locked iPhone those controls stay inactive until the owner unlocks it, and an inline Lock Screen widget offers only one tap target.

Motion is restrained as well. The HIG suggests animated transitions of up to two seconds to signal that new data arrived. When something changes second by second, such as a delivery on its way, Apple points to Live Activities instead of widgets.

How do you design a widget from scratch, step by step?

Design it in five passes, each answering one question before the next begins. The order matters because every later choice depends on the earlier one: you cannot pick a size before you know the data, and you cannot draw a believable empty state before you know the layout.

  1. Decide the data. Write down the single question the widget answers at a glance, such as "how many days until the trip" or "what is next on my calendar".
  2. Pick the size. Take the smallest family that holds the answer and its label. Do not stretch a small design to fill a large one.
  3. Lay it out. Keep 16-point margins, 11 for tight groupings, set text at 11 points or larger, and let corners follow the widget's own radius.
  4. Design the states. Draw the loading placeholder, the empty state, the offline state and a "last updated" label, because the widget will spend real time in each.
  5. Test on a device. Place it on a real page, switch the Home Screen to Dark and Tinted, add the Lock Screen version if there is one, and wait through at least one real refresh.
PassQuestion to answerRule from Apple's guidanceWhat goes wrong if you skip it
DataWhat does someone look for in under a second?A small widget typically shows a single piece of informationA dashboard nobody reads
SizeWhat is the smallest family that fits the answer and its label?Do not expand a small widget's content to fill a larger areaDead space, or text squeezed below legibility
LayoutWhich margins, which type sizes, which corners?16-point margins, 11-point minimum text, corners matched to the widgetCrowded edges and labels too small to read
StatesWhat shows while loading, with no data, offline, or late?Placeholder shapes while data loads; show when data last updatedBlank tiles, or old numbers that look current
TestDoes it hold on the Lock Screen, in Tinted mode, after a refresh?Tinted, Clear and Lock Screen rendering desaturate full colorA design that only works in the editor

The states pass is the one people skip. The HIG's model for a placeholder is static parts of the layout plus semi-opaque bars where text will appear, and its advice for data people check more often than it can refresh is a visible time of the last update.

Building it on WidgetCraft's blank canvas

WidgetCraft, an iPhone and iPad app for iOS 18 and later, turns a design built in its editor into a real WidgetKit widget, and its blank canvas follows the same order. Creation Center asks for the size before anything else: Home Small, Home Medium, Home Large, Lock Circular, Lock Rectangular or Lock Inline.

A design is a tree of layers. Containers, meaning vertical, horizontal and layered stacks plus a grid, hold text, arc text, images, GIFs, dates, charts, buttons and shapes. Relative positioning and a Flexible size with a maximum let a long value shrink instead of overflowing, a Show Grid switch helps with alignment, and Clip to Edges shows at design time what iOS will crop.

Data comes next. Text and number layers bind to weather, location, battery, storage, Health, Calendar, date and time, an HTTP API or a JavaScript snippet, and a Data Provider binding takes a fallback value: the empty state from pass four, written into the widget. The Date layer draws times, relative times, offsets and countdowns with SwiftUI's self-updating date styles, so a countdown keeps moving between reloads instead of spending them. Buttons run through an App Intent and can open another app, play a sound or open a URL, and the preview flips between Light, Dark and Auto.

The details of each layer and binding are in how WidgetCraft's layers and data sources work, and the three ways to start a WidgetCraft widget compares the blank canvas with templates and community imports.

Where WidgetCraft's canvas stops

WidgetCraft cannot remove the platform's limits, and it has a few of its own. Its Home Screen widget comes in small, medium and large only, so the extra-large slot iOS 27 introduced is not available to its designs. The editor estimates the decoded memory of every image and GIF and warns above 15 MB, the point at which a widget can be killed before it renders; a 400 × 400 GIF with 60 frames decodes to about 38 MB however small the file is.

The free tier keeps one saved widget per size, and Pro, sold as a monthly or yearly subscription or a one-time lifetime purchase, removes that cap and opens the VIP designs. The refresh budget still applies: by default a WidgetCraft widget asks iOS for a new timeline 15 minutes after each render, and iOS decides when it arrives. If a finished design is missing or shows stale numbers, the guide to WidgetCraft widgets that won't show or update works through each cause, and making aesthetic iPhone Home Screen widgets covers color, type and the Tinted mode.

When a widget is the wrong tool

Some information should not live in a widget at all, and the refresh budget is usually the reason. Use this test before you start.

  • It changes every few seconds. A live score or a timer you need to pause belongs in a Live Activity or the app.
  • It needs typing, scrolling or a long list of choices. Put the task in the app and let the widget open it at the right screen.
  • The app that owns the data already ships a widget. That widget has the app's own data access; a widget builder only shows what it can reach itself, such as Calendar, Health, weather or a URL you supply.
  • It answers more than one question. Split it into two small widgets or a Smart Stack rather than one crowded large one.

If the information changes on the scale of minutes or hours and answers one question at a glance, build the widget. WidgetCraft is on the App Store if you want to start from its blank canvas.

Frequently asked questions

Can you make your own widgets on an iPhone without coding?
Yes. iOS only places widgets that installed apps provide, so you need an app whose widget renders a design you build. Widget builders such as WidgetCraft give that widget an editor with layers and data sources, and you add the result through the normal Edit, Add Widget flow. The coded route is a WidgetKit extension written in Xcode on a Mac.
How often does an iPhone widget update?
Less often than most people expect. Apple says a widget you look at often typically gets 40 to 70 refreshes a day, roughly every 15 to 60 minutes, and the schedule shifts with how often you view it. Reloads are free while the widget's app is open or when you tap one of its buttons, and clocks or countdowns keep ticking between refreshes because iOS draws those dates itself.
Can an iPhone widget scroll, play video or take text input?
No. A widget is a rendered snapshot built from a limited set of SwiftUI views, and Apple's list has no scroll view, text field or video player. The only interactive controls are buttons and toggles, which run an App Intent on iOS 17 and later and stay inactive while the iPhone is locked. A tap anywhere else opens the app.
Why does my widget look gray on the Home Screen or Lock Screen?
Because iOS is recoloring it. In the Tinted and Clear Home Screen appearances, iOS removes the widget's background, desaturates its content and applies your tint or a glass material, and it desaturates full-color images by default. Lock Screen widgets are drawn in a monochrome vibrant style. Switch the Home Screen back to a light or dark appearance under Edit, Customize to see the original colors.

Products in this post

Keep reading