Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
ad547b74
Commit
ad547b74
authored
Aug 02, 2018
by
Orkhan Alikhanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added updateDivider{Height,Color}
parent
777c8e6c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
25 deletions
+18
-25
Sources/iOS/TextField.swift
+18
-25
No files found.
Sources/iOS/TextField.swift
View file @
ad547b74
...
@@ -135,24 +135,15 @@ open class TextField: UITextField {
...
@@ -135,24 +135,15 @@ open class TextField: UITextField {
@IBInspectable
@IBInspectable
open
var
dividerNormalHeight
:
CGFloat
=
1
{
open
var
dividerNormalHeight
:
CGFloat
=
1
{
didSet
{
didSet
{
guard
!
isEditing
else
{
updateDividerHeight
()
return
}
dividerThickness
=
dividerNormalHeight
}
}
}
}
/// Divider active height.
/// Divider active height.
@IBInspectable
@IBInspectable
open
var
dividerActiveHeight
:
CGFloat
=
2
{
open
var
dividerActiveHeight
:
CGFloat
=
2
{
didSet
{
didSet
{
guard
isEditing
else
{
updateDividerHeight
()
return
}
dividerThickness
=
dividerActiveHeight
}
}
}
}
...
@@ -160,11 +151,7 @@ open class TextField: UITextField {
...
@@ -160,11 +151,7 @@ open class TextField: UITextField {
@IBInspectable
@IBInspectable
open
var
dividerNormalColor
=
Color
.
grey
.
lighten2
{
open
var
dividerNormalColor
=
Color
.
grey
.
lighten2
{
didSet
{
didSet
{
guard
!
isEditing
else
{
updateDividerColor
()
return
}
dividerColor
=
dividerNormalColor
}
}
}
}
...
@@ -172,11 +159,7 @@ open class TextField: UITextField {
...
@@ -172,11 +159,7 @@ open class TextField: UITextField {
@IBInspectable
@IBInspectable
open
var
dividerActiveColor
=
Color
.
blue
.
base
{
open
var
dividerActiveColor
=
Color
.
blue
.
base
{
didSet
{
didSet
{
guard
isEditing
else
{
updateDividerColor
()
return
}
dividerColor
=
dividerActiveColor
}
}
}
}
...
@@ -540,6 +523,16 @@ fileprivate extension TextField {
...
@@ -540,6 +523,16 @@ fileprivate extension TextField {
placeholderLabel
.
textColor
=
isEditing
?
placeholderActiveColor
:
placeholderNormalColor
placeholderLabel
.
textColor
=
isEditing
?
placeholderActiveColor
:
placeholderNormalColor
}
}
/// Updates the dividerColor.
func
updateDividerColor
()
{
dividerColor
=
isEditing
?
dividerActiveColor
:
dividerNormalColor
}
/// Updates the dividerThickness.
func
updateDividerHeight
()
{
dividerThickness
=
isEditing
?
dividerActiveHeight
:
dividerNormalHeight
}
/// Update the placeholder text to the active state.
/// Update the placeholder text to the active state.
func
updatePlaceholderTextToActiveState
()
{
func
updatePlaceholderTextToActiveState
()
{
guard
isPlaceholderUppercasedWhenEditing
else
{
guard
isPlaceholderUppercasedWhenEditing
else
{
...
@@ -701,14 +694,14 @@ extension TextField {
...
@@ -701,14 +694,14 @@ extension TextField {
/// The animation for the divider when editing begins.
/// The animation for the divider when editing begins.
fileprivate
func
dividerEditingDidBeginAnimation
()
{
fileprivate
func
dividerEditingDidBeginAnimation
()
{
dividerThickness
=
dividerActiveHeight
updateDividerHeight
()
dividerColor
=
dividerActiveColor
updateDividerColor
()
}
}
/// The animation for the divider when editing ends.
/// The animation for the divider when editing ends.
fileprivate
func
dividerEditingDidEndAnimation
()
{
fileprivate
func
dividerEditingDidEndAnimation
()
{
dividerThickness
=
dividerNormalHeight
updateDividerHeight
()
dividerColor
=
dividerNormalColor
updateDividerColor
()
}
}
/// The animation for the placeholder when editing begins.
/// The animation for the placeholder when editing begins.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment