generated from dannaward/create-ios-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4292a8f
commit 626c285
Showing
15 changed files
with
342 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
pophory-iOS/Global/Components/PophoryTextFieldCustomizable.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// PophoryTextFieldCustomizable.swift | ||
// pophory-iOS | ||
// | ||
// Created by Joon Baek on 2023/07/24. | ||
// | ||
|
||
import UIKit | ||
|
||
protocol PophoryTextFieldCustomizable: AnyObject { | ||
func createInputTextField(placeholder: String, textFieldManager: TextFieldManager) -> UITextField | ||
func createClearTextFieldButton(textFieldManager: TextFieldManager) -> UIButton | ||
} | ||
|
||
extension PophoryTextFieldCustomizable { | ||
func createInputTextField(placeholder: String, textFieldManager: TextFieldManager) -> UITextField { | ||
let textField = UITextField() | ||
textField.placeholder = placeholder | ||
textField.textColor = .black | ||
textField.backgroundColor = .pophoryGray100 | ||
textField.font = .popupButton | ||
textField.layer.borderColor = UIColor.pophoryGray400.cgColor | ||
textField.layer.borderWidth = 1 | ||
textField.makeRounded(radius: 18) | ||
textField.addPadding(left: 15) | ||
textField.addTarget(textFieldManager, action: #selector(textFieldManager.handleTextFieldEditingChanged), for: .editingChanged) | ||
textField.rightView = createClearTextFieldButton(textFieldManager: textFieldManager) | ||
textField.rightViewMode = .whileEditing | ||
return textField | ||
} | ||
|
||
func createClearTextFieldButton(textFieldManager: TextFieldManager) -> UIButton { | ||
let button = UIButton(type: .custom) | ||
button.setImage(ImageLiterals.placeholderDeleteIcon, for: .normal) | ||
button.addTarget(textFieldManager, action: #selector(textFieldManager.handleTextFieldClearButton), for: .touchUpInside) | ||
button.frame = CGRect(x: 0, y: 0, width: 18, height: 18) | ||
button.contentEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 15) | ||
return button | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
pophory-iOS/Global/Protocols/TextFieldManagerDelegate.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// TextFieldUpdatable.swift | ||
// pophory-iOS | ||
// | ||
// Created by Joon Baek on 2023/08/09. | ||
// | ||
|
||
import UIKit | ||
|
||
protocol TextFieldManagerDelegate: AnyObject { | ||
func updateBorderColor(to color: UIColor) | ||
func setWarningLabelHidden(isHidden: Bool) | ||
func setCharCountLabelText(text: String) | ||
func setWarningLabelText(text: String) | ||
func setNextButtonEnabled(isEnabled: Bool) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.