Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions AnimatedTextInput/Classes/AnimatedTextInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ open class AnimatedTextInput: UIControl {
}

fileprivate func layoutPlaceholderLayer() {
placeholderLayer.frame = CGRect(origin: placeholderPosition, size: CGSize(width: bounds.width, height: (style.textInputFont.pointSize * CGFloat(self.frameHeightCorrectionFactor)) ))
placeholderLayer.frame = CGRect(origin: placeholderPosition, size: CGSize(width: bounds.width, height: (style.placeHolderFont.pointSize * CGFloat(self.frameHeightCorrectionFactor)) ))
}

// mark: Configuration
Expand Down Expand Up @@ -292,8 +292,8 @@ open class AnimatedTextInput: UIControl {
placeholderLayer.masksToBounds = false
placeholderLayer.string = placeHolderText
placeholderLayer.foregroundColor = style.placeholderInactiveColor.cgColor
placeholderLayer.fontSize = style.textInputFont.pointSize
placeholderLayer.font = style.textInputFont
placeholderLayer.fontSize = style.placeHolderFont.pointSize
placeholderLayer.font = style.placeHolderFont
placeholderLayer.contentsScale = UIScreen.main.scale
placeholderLayer.backgroundColor = UIColor.clear.cgColor
layoutPlaceholderLayer()
Expand Down Expand Up @@ -344,7 +344,7 @@ open class AnimatedTextInput: UIControl {

fileprivate func configurePlaceholderAsDefault() {
isPlaceholderAsHint = false
configurePlaceholderWith(fontSize: style.textInputFont.pointSize,
configurePlaceholderWith(fontSize: style.placeHolderFont.pointSize,
foregroundColor: style.placeholderInactiveColor.cgColor,
text: placeHolderText)
lineView.animateToInitialState()
Expand Down Expand Up @@ -385,9 +385,9 @@ open class AnimatedTextInput: UIControl {
fileprivate func styleDidChange() {
lineView.defaultColor = style.lineInactiveColor
placeholderLayer.foregroundColor = style.placeholderInactiveColor.cgColor
let fontSize = style.textInputFont.pointSize
let fontSize = style.placeHolderFont.pointSize
placeholderLayer.fontSize = fontSize
placeholderLayer.font = style.textInputFont
placeholderLayer.font = style.placeHolderFont
textInput.view.tintColor = style.activeColor
textInput.textColor = style.textInputFontColor
textInput.font = style.textInputFont
Expand Down
2 changes: 2 additions & 0 deletions AnimatedTextInput/Classes/AnimatedTextInputStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public protocol AnimatedTextInputStyle {
var lineHeight: CGFloat { get }
var errorColor: UIColor { get }
var textInputFont: UIFont { get }
var placeHolderFont: UIFont { get }
var textInputFontColor: UIColor { get }
var placeholderMinFontSize: CGFloat { get }
var counterLabelFont: UIFont? { get }
Expand All @@ -31,6 +32,7 @@ public struct AnimatedTextInputStyleBlue: AnimatedTextInputStyle {
public let lineHeight: CGFloat = 1.0 / UIScreen.main.scale
public let errorColor = UIColor.red
public let textInputFont = UIFont.systemFont(ofSize: 14)
public let placeHolderFont = UIFont.systemFont(ofSize: 14)
public let textInputFontColor = UIColor.black
public let placeholderMinFontSize: CGFloat = 9
public let counterLabelFont: UIFont? = UIFont.systemFont(ofSize: 9)
Expand Down