Merge pull request #4 from TouchInstinct/feature/open

open functions
This commit is contained in:
Grigory 2017-01-17 17:50:57 +03:00 committed by GitHub
commit 6924be8cee
2 changed files with 12 additions and 12 deletions

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'UIAnimatedTextField' s.name = 'UIAnimatedTextField'
s.version = '0.1.8' s.version = '0.1.9'
s.summary = 'UITextField with animated placeholder' s.summary = 'UITextField with animated placeholder'
s.description = <<-DESC s.description = <<-DESC
This custom control can be used as a replacement for UITextField. It comes with 5 different text types: simple, password, url, tappable, date. This custom control can be used as a replacement for UITextField. It comes with 5 different text types: simple, password, url, tappable, date.

View File

@ -54,7 +54,7 @@ public enum TextType {
} }
@IBDesignable @IBDesignable
public class UIAnimatedTextField: UIView { open class UIAnimatedTextField: UIView {
// MARK: - Constants // MARK: - Constants
struct Constants { struct Constants {
@ -305,7 +305,7 @@ public class UIAnimatedTextField: UIView {
} }
} }
override public func layoutSubviews() { override open func layoutSubviews() {
super.layoutSubviews() super.layoutSubviews()
textField.frame = textFieldFrame() textField.frame = textFieldFrame()
@ -353,7 +353,7 @@ public class UIAnimatedTextField: UIView {
tapAction?(self) tapAction?(self)
} }
public func validateText() -> Bool { open func validateText() -> Bool {
guard let text = textField.text else { guard let text = textField.text else {
return false return false
} }
@ -368,7 +368,7 @@ public class UIAnimatedTextField: UIView {
return true return true
} }
public func showInfo(infoText: String) { open func showInfo(infoText: String) {
guard !isShownInfo else { guard !isShownInfo else {
return return
} }
@ -457,7 +457,7 @@ public class UIAnimatedTextField: UIView {
extension UIAnimatedTextField: UITextFieldDelegate { extension UIAnimatedTextField: UITextFieldDelegate {
public func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { open func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
var result = true var result = true
if let delegateResult = delegate?.animatedTextFieldShouldBeginEditing?(self) { if let delegateResult = delegate?.animatedTextFieldShouldBeginEditing?(self) {
@ -467,7 +467,7 @@ extension UIAnimatedTextField: UITextFieldDelegate {
return result return result
} }
public func textFieldDidBeginEditing(_ textField: UITextField) { open func textFieldDidBeginEditing(_ textField: UITextField) {
if textField.text?.characters.count ?? 0 == 0 { if textField.text?.characters.count ?? 0 == 0 {
setState(toState: .text, duration: UIAnimatedTextField.animationDuration) setState(toState: .text, duration: UIAnimatedTextField.animationDuration)
} }
@ -481,7 +481,7 @@ extension UIAnimatedTextField: UITextFieldDelegate {
delegate?.animatedTextFieldDidBeginEditing?(self) delegate?.animatedTextFieldDidBeginEditing?(self)
} }
public func textFieldShouldEndEditing(_ textField: UITextField) -> Bool { open func textFieldShouldEndEditing(_ textField: UITextField) -> Bool {
var result = true var result = true
if let delegateResult = delegate?.animatedTextFieldShouldEndEditing?(self) { if let delegateResult = delegate?.animatedTextFieldShouldEndEditing?(self) {
@ -491,7 +491,7 @@ extension UIAnimatedTextField: UITextFieldDelegate {
return result return result
} }
public func textFieldDidEndEditing(_ textField: UITextField) { open func textFieldDidEndEditing(_ textField: UITextField) {
if textField.text?.characters.count ?? 0 == 0 { if textField.text?.characters.count ?? 0 == 0 {
setState(toState: .placeholder, duration: UIAnimatedTextField.animationDuration) setState(toState: .placeholder, duration: UIAnimatedTextField.animationDuration)
} }
@ -499,7 +499,7 @@ extension UIAnimatedTextField: UITextFieldDelegate {
delegate?.animatedTextFieldDidEndEditing?(self) delegate?.animatedTextFieldDidEndEditing?(self)
} }
public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, open func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange,
replacementString string: String) -> Bool { replacementString string: String) -> Bool {
var result = true var result = true
@ -524,7 +524,7 @@ extension UIAnimatedTextField: UITextFieldDelegate {
return result return result
} }
public func textFieldShouldClear(_ textField: UITextField) -> Bool { open func textFieldShouldClear(_ textField: UITextField) -> Bool {
var result = true var result = true
if let delegateResult = delegate?.animatedTextFieldShouldClear?(self) { if let delegateResult = delegate?.animatedTextFieldShouldClear?(self) {
@ -534,7 +534,7 @@ extension UIAnimatedTextField: UITextFieldDelegate {
return result return result
} }
public func textFieldShouldReturn(_ textField: UITextField) -> Bool { open func textFieldShouldReturn(_ textField: UITextField) -> Bool {
var result = true var result = true
if let delegateResult = delegate?.animatedTextFieldShouldReturn?(self) { if let delegateResult = delegate?.animatedTextFieldShouldReturn?(self) {