-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUITextField.swift
More file actions
44 lines (32 loc) · 950 Bytes
/
UITextField.swift
File metadata and controls
44 lines (32 loc) · 950 Bytes
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
//
// UITextField.swift
// sopt-37th-02Seminar
//
// Created by JIN on 10/27/25.
//
import Foundation
import UIKit
enum TextFieldStyle: Int {
case email
case password
}
extension UITextField {
func placeholderFallback() {
switch TextFieldStyle(rawValue: self.tag) {
case .email:
self.placeholder = "이메일 아이디"
case .password:
self.placeholder = "비밀번호"
default:
break
}
}
func addHorizontalPadding() {
let leftPadding = UIView(frame: CGRect(x: 0, y: 0, width: 15,height: self.frame.height))
self.leftView = leftPadding
self.leftViewMode = ViewMode.always
let rightPadding = UIView(frame: CGRect(x: 0, y: 0, width: 15,height: self.frame.height))
self.rightView = rightPadding
self.rightViewMode = ViewMode.always
}
}