Carousell Jay Ang Nov 20, 2020

Building iOS 14 Widgets for Carousell - Part 2

This article covers iOS 14 Release notes

Article Summary

Jay Ang and Beemo Lee from Carousell's iOS team shipped their first iOS 14 widget in 2020. Their biggest challenge? Two singleton instances fighting each other across app targets.

When Apple launched iOS 14 widgets, Carousell jumped on the opportunity to bring their Activity tab to users' home screens. The team had to navigate uncharted territory with limited documentation, relying on WWDC videos to answer basic questions about widget capabilities. This deep dive reveals the technical hurdles they hit and the creative solutions they built.

Key Takeaways

Critical Insight

Carousell successfully launched their iOS 14 widget by solving cross-target singleton conflicts, authentication syncing, and keychain accessibility issues that most teams will encounter.

The team discovered a critical Product Module Name collision that broke their entire build, plus a sneaky TestFlight distribution error that required a custom script fix.

About This Article

Problem

The widget extension in Carousell couldn't access updated authentication values from the main app. APIManager existed as separate singleton instances across the two targets, so logout events never showed up in the widget.

Solution

The team created a fresh APIManager instance inside the getTimeline(in:completion:) method. This way, the widget always pulled the latest authentication credentials from Keychain instead of using an outdated singleton reference.

Impact

Authentication stayed in sync between the main app and widget extension in real time. Users no longer saw stale or unauthorized data when their login status changed.