Skip to content
Open
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
7 changes: 6 additions & 1 deletion Sources/CITPincode/CITPincodeView+Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ extension CITPincodeView {

/// If set to true, the keyboard will show once the pincode view appears.
public var showKeyboardOnAppear: Bool


/// If set to true, the toolbar with a button that can close the keyboard will be shown.
public var showKeyboardDoneButton: Bool

/// Text shown for the button that can close the keyboard from a toolbar.
public var keyboardDoneButtonText: String

Expand Down Expand Up @@ -142,6 +145,7 @@ extension CITPincodeView {
selectedBorderWidth: CGFloat = 1,
alwaysShowSelectedBorder: Bool = false,
showKeyboardOnAppear: Bool = true,
showKeyboardDoneButton: Bool = true,
keyboardDoneButtonText: String = "citpincode_keyboard_done_button_text".localized,
cellSize: CGSize = .init(width: 40, height: 56),
cellCornerRadius: CGFloat = 8,
Expand All @@ -163,6 +167,7 @@ extension CITPincodeView {
self.selectedBorderWidth = selectedBorderWidth
self.alwaysShowSelectedBorder = alwaysShowSelectedBorder
self.showKeyboardOnAppear = showKeyboardOnAppear
self.showKeyboardDoneButton = showKeyboardDoneButton
self.keyboardDoneButtonText = keyboardDoneButtonText
self.cellSize = cellSize
self.cellCornerRadius = cellCornerRadius
Expand Down
6 changes: 4 additions & 2 deletions Sources/CITPincode/CITPincodeView.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// CITPincodeView.swift
//
//
// MIT License
//
// Copyright (c) 2022 Coffee IT
Expand Down Expand Up @@ -137,7 +137,9 @@ public struct CITPincodeView: View {
private func setupPasteOnlyTextField(_ textField: UITextField) {
DispatchQueue.main.async {
codeInputField = textField
textField.addDoneButton(config.keyboardDoneButtonText)
if config.showKeyboardDoneButton {
textField.addDoneButton(config.keyboardDoneButtonText)
}
showKeyboardInitially()
}
}
Expand Down