Skip to content

Commit 104fb96

Browse files
Adding support to text field's prompt for iOS 15
1 parent 34f62c5 commit 104fb96

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Sources/ToggleableSecureField/ToggleableSecureField.swift

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,17 @@ public struct ToggleableSecureField: View {
4343
public var body: some View {
4444
VStack {
4545
if isSecure {
46-
SecureField(title, text: text)
46+
if #available(iOS 15.0, *) {
47+
SecureField(title, text: text, prompt: prompt)
48+
} else {
49+
SecureField(title, text: text)
50+
}
4751
} else {
48-
TextField(title, text: text)
52+
if #available(iOS 15.0, *) {
53+
TextField(title, text: text, prompt: prompt)
54+
} else {
55+
TextField(title, text: text)
56+
}
4957
}
5058
}
5159
.textFieldStyle(
@@ -81,6 +89,9 @@ struct ToggleableSecureField_Previews: PreviewProvider {
8189

8290
static var previews: some View {
8391
VStack {
92+
Text("ToggleableSecureField")
93+
.padding()
94+
.font(.headline)
8495
fieldGroup.colorScheme(.light)
8596
fieldGroup.colorScheme(.dark)
8697
}

0 commit comments

Comments
 (0)