Skip to content

Commit 9a56c7a

Browse files
author
Ahmet Sina Ustem
committed
Picker delegations edited
1 parent e8c5448 commit 9a56c7a

3 files changed

Lines changed: 12 additions & 21 deletions

File tree

ALFormInput/Classes/ALDatePicker.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ public class ALDatePicker: ALValidatableTextField {
7272
picker?.show()
7373
}
7474

75-
public override func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
75+
76+
}
77+
78+
// MARK: - UITextFieldDelegate
79+
extension ALDatePicker: UITextFieldDelegate {
80+
public func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
7681
showActionSheetDatePicker()
7782
return false
7883
}

ALFormInput/Classes/ALStringPicker.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ public class ALObjectPicker: ALValidatableTextField {
6969
picker?.show()
7070
}
7171

72-
public override func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
72+
73+
}
74+
75+
// MARK: - ALObjectPicker
76+
extension ALObjectPicker: UITextFieldDelegate {
77+
public func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
7378
showActionSheetStringPicker()
7479
return false
7580
}

ALFormInput/Classes/ALValidatableTextField.swift

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,6 @@ public class ALValidatableTextField: SkyFloatingLabelTextField {
8080
if type == .creditCardNumber {
8181
addTarget(self, action: #selector(formatCreditCardString(_:)), for: .editingChanged)
8282
}
83-
84-
if type == .datePicker {
85-
delegate = self
86-
}
87-
8883
validator.registerField(self, rules: tmpRules)
8984
}
9085

@@ -235,20 +230,6 @@ public class ALValidatableTextField: SkyFloatingLabelTextField {
235230
self.padding = padding
236231
}
237232
}
238-
// MARK: - UITextFieldDelegate
239-
extension ALValidatableTextField: UITextFieldDelegate {
240-
public func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
241-
if type == .datePicker {
242-
243-
return false
244-
}
245-
return true
246-
}
247-
248-
public func textFieldDidEndEditing(_ textField: UITextField) {
249-
//
250-
}
251-
}
252233

253234
// MARK: - TextField Padding
254235
extension ALValidatableTextField {

0 commit comments

Comments
 (0)