-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTextFeildCustom.swift
78 lines (64 loc) · 2.04 KB
/
TextFeildCustom.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
73
74
75
76
77
78
//
// TextFeildCustom.swift
// EassyWorkOut
//
// Created by jeashan anuja on 2023-03-16.
//
import UIKit
class TextFeildCustom: UITextField {
enum TextCustomFeildTypes {
case userFname
case userLname
case Name
case dateOfbirth
case email
case password
case age
case height
case weight
case fitnessGoal
}
private let authFeildType: TextCustomFeildTypes
init(feildType: TextCustomFeildTypes) {
self.authFeildType = feildType
super.init(frame: .zero)
self.backgroundColor = .secondarySystemBackground
self.layer.cornerRadius = 10
self.returnKeyType = .done
self.autocorrectionType = .no
self.autocapitalizationType = .none
self.leftViewMode = .always
self.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 12, height: self.frame.size.height))
switch feildType {
case .userFname:
self.placeholder = "First Name"
case .Name:
self.placeholder = "Your Name"
case .userLname:
self.placeholder = "Last Name"
case .dateOfbirth:
self.placeholder = "Date of birth"
case .fitnessGoal:
self.placeholder = "Fitness goal"
case .age:
self.placeholder = "Age"
self.isEnabled = false
self.isHidden = true
case .height:
self.placeholder = "Height (Kg)"
case .weight:
self.placeholder = "Weight (cm)"
case .email:
self.placeholder = "Email address"
self.keyboardType = .emailAddress
self.textContentType = .emailAddress
case .password:
self.placeholder = "Password"
self.textContentType = .oneTimeCode
self.isSecureTextEntry = true
}
}
required init?(coder: NSCoder) {
fatalError("init (coder) has not been implemented")
}
}