Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions LoopFollow/Helpers/Views/TogglableSecureInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ struct TogglableSecureInput: View {
let placeholder: String
@Binding var text: String
let style: Style
var textContentType: UITextContentType? = nil

@State private var isVisible = false
@FocusState private var isFocused: Bool
Expand All @@ -20,9 +21,13 @@ struct TogglableSecureInput: View {
switch style {
case .singleLine:
if isVisible {
TextField(placeholder, text: $text).multilineTextAlignment(.trailing)
TextField(placeholder, text: $text)
.multilineTextAlignment(.trailing)
.textContentType(textContentType)
} else {
SecureField(placeholder, text: $text).multilineTextAlignment(.trailing)
SecureField(placeholder, text: $text)
.multilineTextAlignment(.trailing)
.textContentType(textContentType)
}

case .multiLine:
Expand Down
5 changes: 3 additions & 2 deletions LoopFollow/Nightscout/NightscoutSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct NightscoutSettingsView: View {
private var urlSection: some View {
Section(header: Text("URL")) {
TextField("Enter URL", text: $viewModel.nightscoutURL)
.textContentType(.URL)
.textContentType(.username)
.autocapitalization(.none)
.disableAutocorrection(true)
.onChange(of: viewModel.nightscoutURL) { newValue in
Expand All @@ -43,7 +43,8 @@ struct NightscoutSettingsView: View {
TogglableSecureInput(
placeholder: "Enter Token",
text: $viewModel.nightscoutToken,
style: .singleLine
style: .singleLine,
textContentType: .password
)
}
}
Expand Down