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
1185c534
Commit
1185c534
authored
Aug 21, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: fixed TextField placeholder animation and updated general code style
parent
8e4bfc89
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
48 additions
and
43 deletions
+48
-43
Sources/iOS/Button.swift
+6
-6
Sources/iOS/CollectionReusableView.swift
+1
-1
Sources/iOS/CollectionView.swift
+1
-1
Sources/iOS/CollectionViewCell.swift
+1
-1
Sources/iOS/CollectionViewLayout.swift
+1
-1
Sources/iOS/ControlView.swift
+1
-1
Sources/iOS/Grid.swift
+1
-1
Sources/iOS/Menu.swift
+1
-1
Sources/iOS/TabBar.swift
+24
-29
Sources/iOS/TextField.swift
+11
-1
No files found.
Sources/iOS/Button.swift
View file @
1185c534
...
@@ -133,7 +133,7 @@ open class Button: UIButton {
...
@@ -133,7 +133,7 @@ open class Button: UIButton {
*/
*/
public
convenience
init
(
image
:
UIImage
?)
{
public
convenience
init
(
image
:
UIImage
?)
{
self
.
init
()
self
.
init
()
prepare
With
(
image
:
image
,
tintColor
:
nil
)
prepare
(
with
:
image
,
tintColor
:
nil
)
}
}
/**
/**
...
@@ -143,7 +143,7 @@ open class Button: UIButton {
...
@@ -143,7 +143,7 @@ open class Button: UIButton {
*/
*/
public
convenience
init
(
image
:
UIImage
?,
tintColor
:
UIColor
?)
{
public
convenience
init
(
image
:
UIImage
?,
tintColor
:
UIColor
?)
{
self
.
init
()
self
.
init
()
prepare
With
(
image
:
image
,
tintColor
:
tintColor
)
prepare
(
with
:
image
,
tintColor
:
tintColor
)
}
}
/**
/**
...
@@ -152,7 +152,7 @@ open class Button: UIButton {
...
@@ -152,7 +152,7 @@ open class Button: UIButton {
*/
*/
public
convenience
init
(
title
:
String
?)
{
public
convenience
init
(
title
:
String
?)
{
self
.
init
()
self
.
init
()
prepare
With
(
title
:
title
,
titleColor
:
nil
)
prepare
(
with
:
title
,
titleColor
:
nil
)
}
}
/**
/**
...
@@ -162,7 +162,7 @@ open class Button: UIButton {
...
@@ -162,7 +162,7 @@ open class Button: UIButton {
*/
*/
public
convenience
init
(
title
:
String
?,
titleColor
:
UIColor
?)
{
public
convenience
init
(
title
:
String
?,
titleColor
:
UIColor
?)
{
self
.
init
()
self
.
init
()
prepare
With
(
title
:
title
,
titleColor
:
titleColor
)
prepare
(
with
:
title
,
titleColor
:
titleColor
)
}
}
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
open
override
func
layoutSublayers
(
of
layer
:
CALayer
)
{
...
@@ -259,7 +259,7 @@ open class Button: UIButton {
...
@@ -259,7 +259,7 @@ open class Button: UIButton {
- Parameter image: A UIImage.
- Parameter image: A UIImage.
- Parameter tintColor: A UIColor.
- Parameter tintColor: A UIColor.
*/
*/
private
func
prepare
With
(
image
:
UIImage
?,
tintColor
:
UIColor
?)
{
private
func
prepare
(
with
image
:
UIImage
?,
tintColor
:
UIColor
?)
{
self
.
image
=
image
self
.
image
=
image
self
.
tintColor
=
tintColor
self
.
tintColor
=
tintColor
}
}
...
@@ -269,7 +269,7 @@ open class Button: UIButton {
...
@@ -269,7 +269,7 @@ open class Button: UIButton {
- Parameter title: A String.
- Parameter title: A String.
- Parameter titleColor: A UIColor.
- Parameter titleColor: A UIColor.
*/
*/
private
func
prepare
With
(
title
:
String
?,
titleColor
:
UIColor
?)
{
private
func
prepare
(
with
title
:
String
?,
titleColor
:
UIColor
?)
{
self
.
title
=
title
self
.
title
=
title
self
.
titleColor
=
titleColor
self
.
titleColor
=
titleColor
}
}
...
...
Sources/iOS/CollectionReusableView.swift
View file @
1185c534
...
@@ -147,7 +147,7 @@ open class MaterialCollectionReusableView: UICollectionReusableView {
...
@@ -147,7 +147,7 @@ open class MaterialCollectionReusableView: UICollectionReusableView {
}
}
/// A preset wrapper around interimSpace.
/// A preset wrapper around interimSpace.
open
var
interimSpacePreset
:
InterimSpacePreset
=
.
none
{
open
var
interimSpacePreset
=
InterimSpacePreset
.
none
{
didSet
{
didSet
{
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
}
}
...
...
Sources/iOS/CollectionView.swift
View file @
1185c534
...
@@ -62,7 +62,7 @@ open class CollectionView: UICollectionView {
...
@@ -62,7 +62,7 @@ open class CollectionView: UICollectionView {
}
}
/// A preset wrapper around interimSpace.
/// A preset wrapper around interimSpace.
open
var
interimSpacePreset
:
InterimSpacePreset
=
.
none
{
open
var
interimSpacePreset
=
InterimSpacePreset
.
none
{
didSet
{
didSet
{
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
}
}
...
...
Sources/iOS/CollectionViewCell.swift
View file @
1185c534
...
@@ -155,7 +155,7 @@ open class CollectionViewCell: UICollectionViewCell {
...
@@ -155,7 +155,7 @@ open class CollectionViewCell: UICollectionViewCell {
}
}
/// A preset wrapper around interimSpace.
/// A preset wrapper around interimSpace.
open
var
interimSpacePreset
:
InterimSpacePreset
=
.
none
{
open
var
interimSpacePreset
=
InterimSpacePreset
.
none
{
didSet
{
didSet
{
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
}
}
...
...
Sources/iOS/CollectionViewLayout.swift
View file @
1185c534
...
@@ -60,7 +60,7 @@ open class CollectionViewLayout: UICollectionViewLayout {
...
@@ -60,7 +60,7 @@ open class CollectionViewLayout: UICollectionViewLayout {
open
var
scrollDirection
:
UICollectionViewScrollDirection
=
.
vertical
open
var
scrollDirection
:
UICollectionViewScrollDirection
=
.
vertical
/// A preset wrapper around interimSpace.
/// A preset wrapper around interimSpace.
open
var
interimSpacePreset
:
InterimSpacePreset
=
.
none
{
open
var
interimSpacePreset
=
InterimSpacePreset
.
none
{
didSet
{
didSet
{
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
}
}
...
...
Sources/iOS/ControlView.swift
View file @
1185c534
...
@@ -58,7 +58,7 @@ open class ControlView: View {
...
@@ -58,7 +58,7 @@ open class ControlView: View {
}
}
/// A preset wrapper around interimSpace.
/// A preset wrapper around interimSpace.
open
var
interimSpacePreset
:
InterimSpacePreset
=
.
none
{
open
var
interimSpacePreset
=
InterimSpacePreset
.
none
{
didSet
{
didSet
{
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
}
}
...
...
Sources/iOS/Grid.swift
View file @
1185c534
...
@@ -159,7 +159,7 @@ public class Grid {
...
@@ -159,7 +159,7 @@ public class Grid {
}
}
/// A preset wrapper for interim space.
/// A preset wrapper for interim space.
public
var
interimSpacePreset
:
InterimSpacePreset
=
.
none
{
public
var
interimSpacePreset
=
InterimSpacePreset
.
none
{
didSet
{
didSet
{
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
}
}
...
...
Sources/iOS/Menu.swift
View file @
1185c534
...
@@ -50,7 +50,7 @@ public class Menu {
...
@@ -50,7 +50,7 @@ public class Menu {
}
}
/// A preset wrapper around interimSpace.
/// A preset wrapper around interimSpace.
public
var
interimSpacePreset
:
InterimSpacePreset
=
.
none
{
public
var
interimSpacePreset
=
InterimSpacePreset
.
none
{
didSet
{
didSet
{
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
}
}
...
...
Sources/iOS/TabBar.swift
View file @
1185c534
...
@@ -41,7 +41,7 @@ open class TabBar: View {
...
@@ -41,7 +41,7 @@ open class TabBar: View {
open
internal(set)
var
line
:
UIView
!
open
internal(set)
var
line
:
UIView
!
/// A value for the line alignment.
/// A value for the line alignment.
open
var
lineAlignment
:
TabBarLineAlignment
=
.
bottom
{
open
var
lineAlignment
=
TabBarLineAlignment
.
bottom
{
didSet
{
didSet
{
layoutSubviews
()
layoutSubviews
()
}
}
...
@@ -74,7 +74,7 @@ open class TabBar: View {
...
@@ -74,7 +74,7 @@ open class TabBar: View {
}
}
/// A preset wrapper around interimSpace.
/// A preset wrapper around interimSpace.
open
var
interimSpacePreset
:
InterimSpacePreset
=
.
none
{
open
var
interimSpacePreset
=
InterimSpacePreset
.
none
{
didSet
{
didSet
{
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
interimSpace
=
InterimSpacePresetToValue
(
preset
:
interimSpacePreset
)
}
}
...
@@ -96,19 +96,16 @@ open class TabBar: View {
...
@@ -96,19 +96,16 @@ open class TabBar: View {
}
}
/// Buttons.
/// Buttons.
open
var
buttons
:
[
UIButton
]?
{
open
var
buttons
=
[
UIButton
]()
{
didSet
{
didSet
{
if
let
v
:
[
UIButton
]
=
oldValue
{
for
b
in
oldValue
{
for
b
in
v
{
b
.
removeFromSuperview
()
b
.
removeFromSuperview
()
}
}
}
if
let
v
:
[
UIButton
]
=
buttons
{
for
b
in
buttons
{
for
b
in
v
{
addSubview
(
b
)
addSubview
(
b
)
}
}
}
layoutSubviews
()
layoutSubviews
()
}
}
}
}
...
@@ -116,20 +113,18 @@ open class TabBar: View {
...
@@ -116,20 +113,18 @@ open class TabBar: View {
open
override
func
layoutSubviews
()
{
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
if
willRenderView
{
if
willRenderView
{
if
let
v
=
buttons
{
if
0
<
buttons
.
count
{
if
0
<
v
.
count
{
let
columns
:
Int
=
grid
.
axis
.
columns
/
buttons
.
count
let
columns
:
Int
=
grid
.
axis
.
columns
/
v
.
count
for
b
in
buttons
{
for
b
in
v
{
b
.
grid
.
columns
=
columns
b
.
grid
.
columns
=
columns
b
.
contentEdgeInsets
=
.
zero
b
.
contentEdgeInsets
=
.
zero
b
.
layer
.
cornerRadius
=
0
b
.
layer
.
cornerRadius
=
0
b
.
removeTarget
(
self
,
action
:
#selector(
handleButton(button:)
)
,
for
:
.
touchUpInside
)
b
.
removeTarget
(
self
,
action
:
#selector(
handleButton(button:)
)
,
for
:
.
touchUpInside
)
b
.
addTarget
(
self
,
action
:
#selector(
handleButton(button:)
)
,
for
:
.
touchUpInside
)
b
.
addTarget
(
self
,
action
:
#selector(
handleButton(button:)
)
,
for
:
.
touchUpInside
)
}
}
grid
.
views
=
buttons
as
[
UIView
]
grid
.
views
=
v
as
[
UIView
]
line
.
frame
=
CGRect
(
x
:
0
,
y
:
.
bottom
==
lineAlignment
?
height
-
3
:
0
,
width
:
buttons
.
first
!.
width
,
height
:
3
)
line
.
frame
=
CGRect
(
x
:
0
,
y
:
.
bottom
==
lineAlignment
?
height
-
3
:
0
,
width
:
v
.
first
!.
frame
.
width
,
height
:
3
)
}
}
}
}
}
}
}
...
@@ -138,8 +133,8 @@ open class TabBar: View {
...
@@ -138,8 +133,8 @@ open class TabBar: View {
internal
func
handleButton
(
button
:
UIButton
)
{
internal
func
handleButton
(
button
:
UIButton
)
{
UIView
.
animate
(
withDuration
:
0.25
,
animations
:
{
[
weak
self
]
in
UIView
.
animate
(
withDuration
:
0.25
,
animations
:
{
[
weak
self
]
in
if
let
s
=
self
{
if
let
s
=
self
{
s
.
line
.
frame
.
origin
.
x
=
button
.
frame
.
origi
n
.
x
s
.
line
.
x
=
butto
n
.
x
s
.
line
.
frame
.
size
.
width
=
button
.
frame
.
size
.
width
s
.
line
.
width
=
button
.
width
}
}
})
})
}
}
...
...
Sources/iOS/TextField.swift
View file @
1185c534
...
@@ -274,6 +274,17 @@ open class TextField: UITextField {
...
@@ -274,6 +274,17 @@ open class TextField: UITextField {
/// A reference to the visibilityIconButton.
/// A reference to the visibilityIconButton.
open
private(set)
var
visibilityIconButton
:
IconButton
?
open
private(set)
var
visibilityIconButton
:
IconButton
?
/**
`layoutIfNeeded` is called within `becomeFirstResponder` to
fix an issue that when the TextField calls `becomeFirstResponder`
immediately when launching an instance, the TextField is not
calculated correctly.
*/
open
override
func
becomeFirstResponder
()
->
Bool
{
layoutIfNeeded
()
return
super
.
becomeFirstResponder
()
}
/**
/**
An initializer that initializes the object with a NSCoder object.
An initializer that initializes the object with a NSCoder object.
- Parameter aDecoder: A NSCoder instance.
- Parameter aDecoder: A NSCoder instance.
...
@@ -314,7 +325,6 @@ open class TextField: UITextField {
...
@@ -314,7 +325,6 @@ open class TextField: UITextField {
/// Handles the text editing did begin state.
/// Handles the text editing did begin state.
open
func
handleEditingDidBegin
()
{
open
func
handleEditingDidBegin
()
{
layoutIfNeeded
()
dividerEditingDidBeginAnimation
()
dividerEditingDidBeginAnimation
()
placeholderEditingDidBeginAnimation
()
placeholderEditingDidBeginAnimation
()
}
}
...
...
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