Commit 84d242e3 by Daniel Dahan

development: completed rework for TextField

parent 55625112
...@@ -107,7 +107,6 @@ ...@@ -107,7 +107,6 @@
TargetAttributes = { TargetAttributes = {
96090AE31D9CDD2E00709CA6 = { 96090AE31D9CDD2E00709CA6 = {
CreatedOnToolsVersion = 8.0; CreatedOnToolsVersion = 8.0;
DevelopmentTeam = 9Z76XCNLGL;
ProvisioningStyle = Automatic; ProvisioningStyle = Automatic;
}; };
}; };
...@@ -263,7 +262,7 @@ ...@@ -263,7 +262,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 9Z76XCNLGL; DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = TextField/Info.plist; INFOPLIST_FILE = TextField/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.TextField; PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.TextField;
...@@ -276,7 +275,7 @@ ...@@ -276,7 +275,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 9Z76XCNLGL; DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = TextField/Info.plist; INFOPLIST_FILE = TextField/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.TextField; PRODUCT_BUNDLE_IDENTIFIER = io.cosmicmind.TextField;
......
...@@ -41,11 +41,11 @@ class ViewController: UIViewController { ...@@ -41,11 +41,11 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = .white view.backgroundColor = Color.grey.lighten5
prepareNameField() prepareNameField()
prepareEmailField() prepareEmailField()
// preparePasswordField() preparePasswordField()
prepareResignResponderButton() prepareResignResponderButton()
} }
...@@ -75,7 +75,6 @@ class ViewController: UIViewController { ...@@ -75,7 +75,6 @@ class ViewController: UIViewController {
nameField.placeholder = "Name" nameField.placeholder = "Name"
nameField.detail = "Your given name" nameField.detail = "Your given name"
nameField.isClearIconButtonEnabled = true nameField.isClearIconButtonEnabled = true
nameField.clearButtonMode = .whileEditing
let leftView = UIImageView() let leftView = UIImageView()
leftView.image = Icon.phone?.tint(with: Color.blue.base) leftView.image = Icon.phone?.tint(with: Color.blue.base)
......
...@@ -184,6 +184,10 @@ open class SearchBar: Bar { ...@@ -184,6 +184,10 @@ open class SearchBar: Bar {
/// Clears the textField text. /// Clears the textField text.
@objc @objc
internal func handleClearButton() { internal func handleClearButton() {
guard nil == textField.delegate?.textFieldShouldClear || true == textField.delegate?.textFieldShouldClear?(textField) else {
return
}
let t = textField.text let t = textField.text
delegate?.searchBar?(searchBar: self, willClear: textField, with: t) delegate?.searchBar?(searchBar: self, willClear: textField, with: t)
......
...@@ -258,7 +258,7 @@ open class TextField: UITextField { ...@@ -258,7 +258,7 @@ open class TextField: UITextField {
} }
clearIconButton = IconButton(image: Icon.cm.clear, tintColor: placeholderNormalColor) clearIconButton = IconButton(image: Icon.cm.clear, tintColor: placeholderNormalColor)
clearIconButton!.contentEdgeInsets = .zero clearIconButton!.contentEdgeInsetsPreset = .none
clearIconButton!.pulseAnimation = .none clearIconButton!.pulseAnimation = .none
clearButtonMode = .never clearButtonMode = .never
rightViewMode = .whileEditing rightViewMode = .whileEditing
...@@ -304,7 +304,7 @@ open class TextField: UITextField { ...@@ -304,7 +304,7 @@ open class TextField: UITextField {
} }
visibilityIconButton = IconButton(image: Icon.visibility, tintColor: placeholderNormalColor.withAlphaComponent(isSecureTextEntry ? 0.38 : 0.54)) visibilityIconButton = IconButton(image: Icon.visibility, tintColor: placeholderNormalColor.withAlphaComponent(isSecureTextEntry ? 0.38 : 0.54))
visibilityIconButton!.contentEdgeInsets = .zero visibilityIconButton!.contentEdgeInsetsPreset = .none
visibilityIconButton!.pulseAnimation = .none visibilityIconButton!.pulseAnimation = .none
isSecureTextEntry = true isSecureTextEntry = true
clearButtonMode = .never clearButtonMode = .never
...@@ -412,7 +412,7 @@ open class TextField: UITextField { ...@@ -412,7 +412,7 @@ open class TextField: UITextField {
/// Handles the clearIconButton TouchUpInside event. /// Handles the clearIconButton TouchUpInside event.
@objc @objc
open func handleClearIconButton() { open func handleClearIconButton() {
guard true == delegate?.textFieldShouldClear?(self) else { guard nil == delegate?.textFieldShouldClear || true == delegate?.textFieldShouldClear?(self) else {
return return
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment