Member-only story
How to Hide Sensitive Widget Data When Device Is Locked?
Protect your users’ privacy with these simple approaches!
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:
- Partial privacy redactions
- 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)…