Skip to content

Commit 6aa0239

Browse files
committed
Change input fields to be masked instead of invisible in screenshots
1 parent b98e26d commit 6aa0239

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

LoopFollow/Helpers/Views/TogglableSecureInput.swift

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,22 @@ struct TogglableSecureInput: View {
2020
Group {
2121
switch style {
2222
case .singleLine:
23-
if isVisible {
24-
TextField(placeholder, text: $text)
25-
.multilineTextAlignment(.trailing)
26-
.textContentType(textContentType)
27-
.submitLabel(.done)
28-
.focused($isFocused)
29-
} else {
30-
SecureField(placeholder, text: $text)
31-
.multilineTextAlignment(.trailing)
32-
.textContentType(textContentType)
33-
.submitLabel(.done)
34-
.focused($isFocused)
23+
ZStack(alignment: .trailing) {
24+
if isVisible {
25+
TextField(placeholder, text: $text)
26+
.multilineTextAlignment(.trailing)
27+
.textContentType(textContentType)
28+
.submitLabel(.done)
29+
.focused($isFocused)
30+
} else {
31+
HStack {
32+
Spacer()
33+
Text(maskString)
34+
.font(.body.monospaced())
35+
.foregroundColor(.primary)
36+
.allowsHitTesting(false)
37+
}
38+
}
3539
}
3640

3741
case .multiLine:
@@ -53,15 +57,13 @@ struct TogglableSecureInput: View {
5357
}
5458

5559
if !isVisible {
56-
Text(maskString)
57-
.font(.body.monospaced())
58-
.foregroundColor(.primary)
59-
.frame(maxWidth: .infinity,
60-
maxHeight: .infinity,
61-
alignment: .topLeading)
62-
.padding(.top, 8)
63-
.padding(.leading, 5)
64-
.allowsHitTesting(false)
60+
HStack {
61+
Spacer()
62+
Text(maskString)
63+
.font(.body.monospaced())
64+
.foregroundColor(.primary)
65+
.allowsHitTesting(false)
66+
}
6567
}
6668
}
6769
.frame(minHeight: 100)

0 commit comments

Comments
 (0)