-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathInputFieldDelegate.swift
72 lines (57 loc) · 2.06 KB
/
InputFieldDelegate.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// InputFieldDelegate.swift
//
// Made with ❤️ by Novum
//
// Copyright © Telefonica. All rights reserved.
//
import Foundation
import UIKit
public protocol InputFieldDelegate: AnyObject {
func inputFieldTextDidChange(_ field: InputField)
func inputFieldShouldBeginEditing(_ field: InputField) -> Bool
func inputFieldShouldReturn(_ field: InputField) -> Bool
func inputFieldDidBeginEditing(_ field: InputField)
func inputFieldDidEndEditing(_ field: InputField)
func inputField(_ field: InputField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool
func inputField(_ field: InputField, didTapLeadingButton button: UIButton)
func inputField(_ field: InputField, didTapTraillingButton button: UIButton)
func inputFieldDidUpdateState(_ field: InputField)
func inputFieldShouldLayout(_ field: InputField)
}
@objc public protocol InputFieldDataSource: AnyObject {
func inputFieldPickerElements(_ inputField: InputField) -> [String]
func inputField(_ inputField: InputField, didSelectPickerElementAt index: Int)
}
public extension InputFieldDelegate {
func inputFieldTextDidChange(_: InputField) {
// Do nothing by default
}
func inputFieldShouldBeginEditing(_: InputField) -> Bool {
true
}
func inputFieldShouldReturn(_: InputField) -> Bool {
true
}
func inputFieldDidBeginEditing(_: InputField) {
// Do nothing by default
}
func inputFieldDidEndEditing(_: InputField) {
// Do nothing by default
}
func inputField(_: InputField, shouldChangeCharactersIn _: NSRange, replacementString _: String) -> Bool {
true
}
func inputField(_: InputField, didTapLeadingButton _: UIButton) {
// Do nothing by default
}
func inputField(_: InputField, didTapTraillingButton _: UIButton) {
// Do nothing by default
}
func inputFieldDidUpdateState(_: InputField) {
// Do nothing by default
}
func inputFieldShouldLayout(_: InputField) {
// Do nothing by default
}
}