---
title: "Lessons From Building iOS Widgets"
description: "Shopify’s widget team describes a third-generation redesign for iOS and Android after the original iOS widgets offered only two metrics and consumed substantial space. The widgets target merchants who need fresh shop analytics, using native SwiftUI on iOS because WidgetKit extensions have memory constraints, serialize SwiftUI view hierarchies to disk, and lacked official React Native support. Independent widget-side fetching uses shared session-management code and tokens; repeated update callbacks caused duplicate network requests and token-refresh races, so the team introduced a short-lived, widget-specific cache. Replacing existing widgets also exposed migration limits: changing widget kind identifiers could blank or remove installed widgets, leading Shopify to deprecate old widgets while releasing new ones and guide merchants through the transition. The team planned further customization and integration with iOS 16 features, including watch and lock-screen complications and live activities."
---

# Lessons From Building iOS Widgets

[Shopify](https://yomu.fyi/company/shopify) · 2023-10-18 · Sep 22, 2022

**Type:** Explainer

## Summary

Shopify’s widget team describes a third-generation redesign for iOS and Android after the original iOS widgets offered only two metrics and consumed substantial space. The widgets target merchants who need fresh shop analytics, using native SwiftUI on iOS because WidgetKit extensions have memory constraints, serialize SwiftUI view hierarchies to disk, and lacked official React Native support. Independent widget-side fetching uses shared session-management code and tokens; repeated update callbacks caused duplicate network requests and token-refresh races, so the team introduced a short-lived, widget-specific cache. Replacing existing widgets also exposed migration limits: changing widget kind identifiers could blank or remove installed widgets, leading Shopify to deprecate old widgets while releasing new ones and guide merchants through the transition. The team planned further customization and integration with iOS 16 features, including watch and lock-screen complications and live activities.

## Context

Shopify’s original widgets provided only two metrics, occupied substantial space, and needed to better serve merchants who monitor business analytics and require current information for decisions. The team also encountered duplicate network requests, authentication-token races, and difficult migration behavior when replacing existing widgets.

## Approach / What changed

The team built a new widget generation with native SwiftUI on iOS, while aiming for a consistent iOS and Android experience. Widgets fetched analytics independently through Reportify and ShopifyQL, shared session-management code and tokens with the app, and used a short-lived cache to reduce repeated requests. Existing widgets were deprecated alongside the new widgets, with help-center guidance supporting the transition.

## Takeaways

- WidgetKit’s memory limits, serialized SwiftUI view hierarchy, and lack of official React Native widget support led Shopify to choose native SwiftUI for iOS widgets.
- Repeated getTimeline() and getSnapshot() calls triggered two to five extra network requests and could create out-of-order token refreshes that logged merchants out; a short-lived, widget-specific cache addressed unnecessary roundtrips.
- Changing widget kind identifiers could turn installed widgets into blank squares or remove them, so Shopify deprecated old widgets instead of attempting a direct replacement.

**Tags:** [Android](https://yomu.fyi/topic/android), [Architecture](https://yomu.fyi/topic/architecture), [Caching](https://yomu.fyi/topic/caching), [iOS](https://yomu.fyi/topic/ios), [Performance](https://yomu.fyi/topic/performance)

- Source: [Shopify](https://shopify.engineering/lessons-building-ios-widgets)
- Source URL: https://shopify.engineering/lessons-building-ios-widgets
- Ingested by Yomu: 2026-08-30T13:38:56.164Z

[Read original post](https://shopify.engineering/lessons-building-ios-widgets)
