Member-only story

How to Hide Sensitive Widget Data When Device Is Locked?

Protect your users’ privacy with these simple approaches!

Lee Kah Seng
4 min readMar 28, 2023

This article is originally published at swiftsenpai.com

With the introduction of widgets in iOS, users can now easily access information from their favorite apps right at the lock screen and Today View. As good as it might seem, this does introduce privacy issues whereby sensitive data can become accessible even though the device is locked.

To address this issue, we can take the following approaches:

  1. Partial privacy redactions
  2. Full privacy redactions

In this article, we will go through each of these approaches. So let’s get right into it!

Partial Privacy Redactions

As the name implies, Partial Privacy Redactions will only redact some of the UI elements in the widgets. Let’s say we have a Bitcoin wallet widget that shows the user’s current Bitcoin balance.

var body: some View {

VStack(alignment: .leading) {

Text("Bitcoin Balance")
.font(.title2)
.fontWeight(.bold)
.foregroundColor(.orange)

// Show Bitcoin balance
Text("0.25₿")
.font(.headline)…

--

--

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