Commit e46c5a84 by Daniel Dahan

Merge branch 'master' into development

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