Commit e46c5a84 by Daniel Dahan

Merge branch 'master' into development

parents eeee26a3 95f455aa
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Material' s.name = 'Material'
s.version = '2.4.10' s.version = '2.4.11'
s.license = 'BSD-3-Clause' s.license = 'BSD-3-Clause'
s.summary = 'An animation and graphics framework for Material Design in Swift.' s.summary = 'An animation and graphics framework for Material Design in Swift.'
s.homepage = 'http://materialswift.com' s.homepage = 'http://materialswift.com'
s.social_media_url = 'https://www.facebook.com/cosmicmindio' s.social_media_url = 'https://www.facebook.com/cosmicmindcom'
s.authors = { 'CosmicMind, Inc.' => 'support@cosmicmind.com' } s.authors = { 'CosmicMind, Inc.' => 'support@cosmicmind.com' }
s.source = { :git => 'https://github.com/CosmicMind/Material.git', :tag => s.version } s.source = { :git => 'https://github.com/CosmicMind/Material.git', :tag => s.version }
s.platform = :ios, '8.0' s.platform = :ios, '8.0'
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>2.4.10</string> <string>2.4.11</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -30,6 +30,12 @@ ...@@ -30,6 +30,12 @@
import UIKit import UIKit
@objc(TextFieldPlaceholderAnimation)
public enum TextFieldPlaceholderAnimation: Int {
case `default`
case hidden
}
@objc(TextFieldDelegate) @objc(TextFieldDelegate)
public protocol TextFieldDelegate: UITextFieldDelegate { public protocol TextFieldDelegate: UITextFieldDelegate {
/** /**
...@@ -67,6 +73,13 @@ open class TextField: UITextField { ...@@ -67,6 +73,13 @@ open class TextField: UITextField {
@IBInspectable @IBInspectable
open var isPlaceholderAnimated = true open var isPlaceholderAnimated = true
/// Set the placeholder animation value.
open var placeholderAnimation = TextFieldPlaceholderAnimation.default {
didSet {
placeholderLabel.isHidden = .hidden == placeholderAnimation && !isEmpty
}
}
/// A boolean indicating whether the text is empty. /// A boolean indicating whether the text is empty.
open var isEmpty: Bool { open var isEmpty: Bool {
return 0 == text?.utf16.count return 0 == text?.utf16.count
...@@ -599,6 +612,11 @@ extension TextField { ...@@ -599,6 +612,11 @@ extension TextField {
/// The animation for the placeholder when editing begins. /// The animation for the placeholder when editing begins.
fileprivate func placeholderEditingDidBeginAnimation() { fileprivate func placeholderEditingDidBeginAnimation() {
guard .default == placeholderAnimation else {
placeholderLabel.isHidden = true
return
}
updatePlaceholderLabelColor() updatePlaceholderLabelColor()
guard isPlaceholderAnimated else { guard isPlaceholderAnimated else {
...@@ -630,6 +648,11 @@ extension TextField { ...@@ -630,6 +648,11 @@ extension TextField {
/// The animation for the placeholder when editing ends. /// The animation for the placeholder when editing ends.
fileprivate func placeholderEditingDidEndAnimation() { fileprivate func placeholderEditingDidEndAnimation() {
guard .default == placeholderAnimation else {
placeholderLabel.isHidden = !isEmpty
return
}
updatePlaceholderLabelColor() updatePlaceholderLabelColor()
guard isPlaceholderAnimated else { guard isPlaceholderAnimated else {
......
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