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
928ba8cb
Unverified
Commit
928ba8cb
authored
Sep 09, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: updated access rights and renamed ControlView to ContentView
parent
05b19fa0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
122 additions
and
112 deletions
+122
-112
Material.xcodeproj/project.pbxproj
+18
-10
Sources/iOS/BarView.swift
+1
-1
Sources/iOS/Button.swift
+1
-1
Sources/iOS/Capture.swift
+5
-5
Sources/iOS/CaptureSession.swift
+2
-2
Sources/iOS/CollectionView.swift
+4
-4
Sources/iOS/CollectionViewLayout.swift
+15
-15
Sources/iOS/ContentView.swift
+5
-3
Sources/iOS/Menu.swift
+8
-7
Sources/iOS/NavigationDrawerController.swift
+49
-49
Sources/iOS/SearchBar.swift
+6
-7
Sources/iOS/Switch.swift
+0
-0
Sources/iOS/TextField.swift
+8
-8
No files found.
Material.xcodeproj/project.pbxproj
View file @
928ba8cb
...
...
@@ -32,7 +32,7 @@
96BCB7A41CB40DC500C806FE
/* CaptureSession.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB75B1CB40DC500C806FE
/* CaptureSession.swift */
;
};
96BCB7A51CB40DC500C806FE
/* Capture.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB75C1CB40DC500C806FE
/* Capture.swift */
;
};
96BCB7A61CB40DC500C806FE
/* Card.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB75D1CB40DC500C806FE
/* Card.swift */
;
};
96BCB7A71CB40DC500C806FE
/* Cont
rolView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB75E1CB40DC500C806FE
/* Control
View.swift */
;
};
96BCB7A71CB40DC500C806FE
/* Cont
entView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB75E1CB40DC500C806FE
/* Content
View.swift */
;
};
96BCB7A81CB40DC500C806FE
/* FabButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB75F1CB40DC500C806FE
/* FabButton.swift */
;
};
96BCB7A91CB40DC500C806FE
/* FlatButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7601CB40DC500C806FE
/* FlatButton.swift */
;
};
96BCB7AA1CB40DC500C806FE
/* Grid.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7611CB40DC500C806FE
/* Grid.swift */
;
};
...
...
@@ -133,7 +133,7 @@
96BCB8351CB4115200C806FE
/* MaterialTextLayer.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB78A1CB40DC500C806FE
/* MaterialTextLayer.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8361CB4115200C806FE
/* Grid.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7611CB40DC500C806FE
/* Grid.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8371CB4115200C806FE
/* Layout.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7811CB40DC500C806FE
/* Layout.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8381CB4115200C806FE
/* Cont
rolView.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB75E1CB40DC500C806FE
/* Control
View.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8381CB4115200C806FE
/* Cont
entView.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB75E1CB40DC500C806FE
/* Content
View.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB8391CB4115200C806FE
/* SearchBar.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7951CB40DC500C806FE
/* SearchBar.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB83A1CB4115200C806FE
/* SearchBarController.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7961CB40DC500C806FE
/* SearchBarController.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
96BCB83B1CB4115200C806FE
/* NavigationDrawerController.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7971CB40DC500C806FE
/* NavigationDrawerController.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
...
...
@@ -225,7 +225,7 @@
96BCB75B1CB40DC500C806FE
/* CaptureSession.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CaptureSession.swift
;
sourceTree
=
"<group>"
;
};
96BCB75C1CB40DC500C806FE
/* Capture.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Capture.swift
;
sourceTree
=
"<group>"
;
};
96BCB75D1CB40DC500C806FE
/* Card.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Card.swift
;
sourceTree
=
"<group>"
;
};
96BCB75E1CB40DC500C806FE
/* Cont
rolView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Control
View.swift
;
sourceTree
=
"<group>"
;
};
96BCB75E1CB40DC500C806FE
/* Cont
entView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Content
View.swift
;
sourceTree
=
"<group>"
;
};
96BCB75F1CB40DC500C806FE
/* FabButton.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
FabButton.swift
;
sourceTree
=
"<group>"
;
};
96BCB7601CB40DC500C806FE
/* FlatButton.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
FlatButton.swift
;
sourceTree
=
"<group>"
;
};
96BCB7611CB40DC500C806FE
/* Grid.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Grid.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -342,6 +342,14 @@
name
=
Divider
;
sourceTree
=
"<group>"
;
};
96264BE41D833C8400576F37
/* BarView */
=
{
isa
=
PBXGroup
;
children
=
(
96BCB7981CB40DC500C806FE
/* BarView.swift */
,
);
name
=
BarView
;
sourceTree
=
"<group>"
;
};
962864601D5410FD00690B69
/* JSON */
=
{
isa
=
PBXGroup
;
children
=
(
...
...
@@ -448,13 +456,12 @@
name
=
SearchBar
;
sourceTree
=
"<group>"
;
};
963FBF061D669795008F8512
/* Cont
rol
View */
=
{
963FBF061D669795008F8512
/* Cont
ent
View */
=
{
isa
=
PBXGroup
;
children
=
(
96BCB75E1CB40DC500C806FE
/* ControlView.swift */
,
96BCB7981CB40DC500C806FE
/* BarView.swift */
,
96BCB75E1CB40DC500C806FE
/* ContentView.swift */
,
);
name
=
Cont
rol
View
;
name
=
Cont
ent
View
;
sourceTree
=
"<group>"
;
};
9661222C1D3EC414008BB4CB
/* macOS */
=
{
...
...
@@ -509,12 +516,13 @@
isa
=
PBXGroup
;
children
=
(
96BCB8091CB4107700C806FE
/* Animate */
,
96264BE41D833C8400576F37
/* BarView */
,
962DDD081D6FBBD0001C307C
/* BottomTabBar */
,
96BCB8031CB40F4B00C806FE
/* Button */
,
96BCB8021CB40F3B00C806FE
/* Card */
,
96BCB7FF1CB40EF000C806FE
/* Capture */
,
96BCB8051CB40F9C00C806FE
/* Collection */
,
963FBF061D669795008F8512
/* Cont
rol
View */
,
963FBF061D669795008F8512
/* Cont
ent
View */
,
96BCB8001CB40F0300C806FE
/* Color */
,
962A92581D42839100DBAF8E
/* Data */
,
96BCB80B1CB410CC00C806FE
/* Device */
,
...
...
@@ -808,7 +816,7 @@
96BCB8351CB4115200C806FE
/* MaterialTextLayer.swift in Headers */
,
96BCB8361CB4115200C806FE
/* Grid.swift in Headers */
,
96BCB8371CB4115200C806FE
/* Layout.swift in Headers */
,
96BCB8381CB4115200C806FE
/* Cont
rol
View.swift in Headers */
,
96BCB8381CB4115200C806FE
/* Cont
ent
View.swift in Headers */
,
96BCB8391CB4115200C806FE
/* SearchBar.swift in Headers */
,
96BCB83A1CB4115200C806FE
/* SearchBarController.swift in Headers */
,
96BCB83B1CB4115200C806FE
/* NavigationDrawerController.swift in Headers */
,
...
...
@@ -1101,7 +1109,7 @@
96BCB7D21CB40DC500C806FE
/* TableViewCell.swift in Sources */
,
96F1DC881D654FDF0025F925
/* Material+CALayer.swift in Sources */
,
96BCB7B61CB40DC500C806FE
/* Animation.swift in Sources */
,
96BCB7A71CB40DC500C806FE
/* Cont
rol
View.swift in Sources */
,
96BCB7A71CB40DC500C806FE
/* Cont
ent
View.swift in Sources */
,
96BCB7DB1CB40DC500C806FE
/* NavigationItem.swift in Sources */
,
96BCB7E01CB40DC500C806FE
/* NavigationDrawerController.swift in Sources */
,
9628645F1D540AF300690B69
/* DynamicFontType.swift in Sources */
,
...
...
Sources/iOS/BarView.swift
View file @
928ba8cb
...
...
@@ -30,7 +30,7 @@
import
UIKit
open
class
BarView
:
Cont
rol
View
{
open
class
BarView
:
Cont
ent
View
{
/// Divider layer.
open
internal(set)
var
divider
:
Divider
!
...
...
Sources/iOS/Button.swift
View file @
928ba8cb
...
...
@@ -42,7 +42,7 @@ open class Button: UIButton {
open
private(set)
lazy
var
visualLayer
=
CAShapeLayer
()
/// An Array of pulse layers.
public
private(set)
lazy
var
pulseLayers
=
[
CAShapeLayer
]()
open
private(set)
lazy
var
pulseLayers
=
[
CAShapeLayer
]()
/// The opacity value for the pulse animation.
@IBInspectable
...
...
Sources/iOS/Capture.swift
View file @
928ba8cb
...
...
@@ -221,19 +221,19 @@ open class Capture: View, UIGestureRecognizerDelegate {
}
/// A reference to the CapturePreview view.
open
private
(set)
var
previewView
:
CapturePreview
!
open
internal
(set)
var
previewView
:
CapturePreview
!
/// A reference to the CaptureSession.
open
private
(set)
var
captureSession
:
CaptureSession
!
open
internal
(set)
var
captureSession
:
CaptureSession
!
/// A reference to the focus layer used in focus animations.
open
private
(set)
var
focusLayer
:
Layer
?
open
internal
(set)
var
focusLayer
:
Layer
?
/// A reference to the exposure layer used in exposure animations.
open
private
(set)
var
exposureLayer
:
Layer
?
open
internal
(set)
var
exposureLayer
:
Layer
?
/// A reference to the reset layer used in reset animations.
open
private
(set)
var
resetLayer
:
Layer
?
open
internal
(set)
var
resetLayer
:
Layer
?
/// A reference to the cameraButton.
open
var
cameraButton
:
UIButton
?
{
...
...
Sources/iOS/CaptureSession.swift
View file @
928ba8cb
...
...
@@ -192,10 +192,10 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
internal
var
session
:
AVCaptureSession
!
/// A boolean indicating if the session is running.
open
private(set)
var
isRunning
:
Bool
=
false
open
internal(set)
var
isRunning
=
false
/// A boolean indicating if the session is recording.
open
private(set)
var
isRecording
:
Bool
=
false
open
internal(set)
var
isRecording
=
false
/// A reference to the recorded time duration.
open
var
recordedDuration
:
CMTime
{
...
...
Sources/iOS/CollectionView.swift
View file @
928ba8cb
...
...
@@ -35,19 +35,19 @@ open class CollectionView: UICollectionView {
/// A preset wrapper around contentInset.
open
var
contentEdgeInsetsPreset
:
EdgeInsets
{
get
{
return
(
collectionViewLayout
as?
CollectionViewLayout
)
!.
content
Inset
return
(
collectionViewLayout
as?
CollectionViewLayout
)
!.
content
EdgeInsets
}
set
(
value
)
{
(
collectionViewLayout
as?
CollectionViewLayout
)
!.
content
Inset
=
value
(
collectionViewLayout
as?
CollectionViewLayout
)
!.
content
EdgeInsets
=
value
}
}
open
override
var
contentInset
:
UIEdgeInsets
{
get
{
return
(
collectionViewLayout
as?
CollectionViewLayout
)
!.
content
Inset
return
(
collectionViewLayout
as?
CollectionViewLayout
)
!.
content
EdgeInsets
}
set
(
value
)
{
(
collectionViewLayout
as?
CollectionViewLayout
)
!.
content
Inset
=
value
(
collectionViewLayout
as?
CollectionViewLayout
)
!.
content
EdgeInsets
=
value
}
}
...
...
Sources/iOS/CollectionViewLayout.swift
View file @
928ba8cb
...
...
@@ -37,27 +37,27 @@ open class CollectionViewLayout: UICollectionViewLayout {
/// The size of items.
open
var
itemSize
=
CGSize
.
zero
/// A preset wrapper around content
Inset
.
/// A preset wrapper around content
EdgeInsets
.
open
var
contentEdgeInsetsPreset
:
EdgeInsetsPreset
=
.
none
{
didSet
{
content
Inset
=
EdgeInsetsPresetToValue
(
preset
:
contentEdgeInsetsPreset
)
content
EdgeInsets
=
EdgeInsetsPresetToValue
(
preset
:
contentEdgeInsetsPreset
)
}
}
/// A wrapper around grid.content
Inset
.
open
var
content
Inset
=
EdgeInsets
.
zero
/// A wrapper around grid.content
EdgeInsets
.
open
var
content
EdgeInsets
=
EdgeInsets
.
zero
/// Size of the content.
open
private
(set)
var
contentSize
=
CGSize
.
zero
open
internal
(set)
var
contentSize
=
CGSize
.
zero
/// Layout attribute items.
open
private(set)
var
layoutItems
=
[(
UICollectionViewLayoutAttributes
,
NSIndexPath
)]()
open
internal(set)
lazy
var
layoutItems
=
[(
UICollectionViewLayoutAttributes
,
NSIndexPath
)]()
/// Cell data source items.
open
private
(set)
var
dataSourceItems
:
[
DataSourceItem
]?
open
internal
(set)
var
dataSourceItems
:
[
DataSourceItem
]?
/// Scroll direction.
open
var
scrollDirection
:
UICollectionViewScrollDirection
=
.
vertical
open
var
scrollDirection
=
UICollectionViewScrollDirection
.
vertical
/// A preset wrapper around interimSpace.
open
var
interimSpacePreset
=
InterimSpacePreset
.
none
{
...
...
@@ -93,11 +93,11 @@ open class CollectionViewLayout: UICollectionViewLayout {
let
item
:
DataSourceItem
=
dataSourceItems
!
[
indexPath
.
item
]
if
0
<
itemSize
.
width
&&
0
<
itemSize
.
height
{
attributes
.
frame
=
CGRect
(
x
:
offset
.
x
,
y
:
offset
.
y
,
width
:
itemSize
.
width
-
content
Inset
.
left
-
contentInset
.
right
,
height
:
itemSize
.
height
-
contentInset
.
top
-
contentInset
.
bottom
)
attributes
.
frame
=
CGRect
(
x
:
offset
.
x
,
y
:
offset
.
y
,
width
:
itemSize
.
width
-
content
EdgeInsets
.
left
-
contentEdgeInsets
.
right
,
height
:
itemSize
.
height
-
contentEdgeInsets
.
top
-
contentEdgeInsets
.
bottom
)
}
else
if
.
vertical
==
scrollDirection
{
attributes
.
frame
=
CGRect
(
x
:
content
Inset
.
left
,
y
:
offset
.
y
,
width
:
collectionView
!.
bounds
.
width
-
contentInset
.
left
-
contentInset
.
right
,
height
:
item
.
height
??
collectionView
!.
bounds
.
height
)
attributes
.
frame
=
CGRect
(
x
:
content
EdgeInsets
.
left
,
y
:
offset
.
y
,
width
:
collectionView
!.
bounds
.
width
-
contentEdgeInsets
.
left
-
contentEdgeInsets
.
right
,
height
:
item
.
height
??
collectionView
!.
bounds
.
height
)
}
else
{
attributes
.
frame
=
CGRect
(
x
:
offset
.
x
,
y
:
content
Inset
.
top
,
width
:
item
.
width
??
collectionView
!.
bounds
.
width
,
height
:
collectionView
!.
bounds
.
height
-
contentInset
.
top
-
contentInset
.
bottom
)
attributes
.
frame
=
CGRect
(
x
:
offset
.
x
,
y
:
content
EdgeInsets
.
top
,
width
:
item
.
width
??
collectionView
!.
bounds
.
width
,
height
:
collectionView
!.
bounds
.
height
-
contentEdgeInsets
.
top
-
contentEdgeInsets
.
bottom
)
}
return
attributes
...
...
@@ -131,8 +131,8 @@ open class CollectionViewLayout: UICollectionViewLayout {
self
.
dataSourceItems
=
dataSourceItems
layoutItems
.
removeAll
()
offset
.
x
=
content
Inset
.
left
offset
.
y
=
content
Inset
.
top
offset
.
x
=
content
EdgeInsets
.
left
offset
.
y
=
content
EdgeInsets
.
top
for
i
in
0
..<
dataSourceItems
.
count
{
let
item
:
DataSourceItem
=
dataSourceItems
[
i
]
...
...
@@ -146,8 +146,8 @@ open class CollectionViewLayout: UICollectionViewLayout {
offset
.
y
+=
nil
==
item
.
height
?
itemSize
.
height
:
item
.
height
!
}
offset
.
x
+=
content
Inset
.
right
-
interimSpace
offset
.
y
+=
content
Inset
.
bottom
-
interimSpace
offset
.
x
+=
content
EdgeInsets
.
right
-
interimSpace
offset
.
y
+=
content
EdgeInsets
.
bottom
-
interimSpace
if
0
<
itemSize
.
width
&&
0
<
itemSize
.
height
{
contentSize
=
CGSize
(
width
:
offset
.
x
,
height
:
offset
.
y
)
...
...
Sources/iOS/Cont
rol
View.swift
→
Sources/iOS/Cont
ent
View.swift
View file @
928ba8cb
...
...
@@ -36,7 +36,7 @@ public enum ContentViewAlignment: Int {
case
center
}
open
class
Cont
rol
View
:
View
{
open
class
Cont
ent
View
:
View
{
/// Should center the contentView.
open
var
contentViewAlignment
=
ContentViewAlignment
.
any
{
didSet
{
...
...
@@ -93,7 +93,8 @@ open class ControlView: View {
}
/// Grid cell factor.
@IBInspectable
open
var
gridFactor
:
CGFloat
=
24
{
@IBInspectable
open
var
gridFactor
:
CGFloat
=
24
{
didSet
{
assert
(
0
<
gridFactor
,
"[Material Error: gridFactor must be greater than 0.]"
)
layoutSubviews
()
...
...
@@ -101,7 +102,7 @@ open class ControlView: View {
}
/// ContentView that holds the any desired subviews.
open
private(set)
lazy
var
contentView
:
UIView
=
UIView
()
open
private(set)
lazy
var
contentView
=
UIView
()
/// Left side UIControls.
open
var
leftControls
=
[
UIView
]()
{
...
...
@@ -196,6 +197,7 @@ open class ControlView: View {
}
contentView
.
grid
.
begin
()
if
.
center
==
contentViewAlignment
{
if
lc
<
rc
{
contentView
.
grid
.
columns
=
columns
-
2
*
rc
...
...
Sources/iOS/Menu.swift
View file @
928ba8cb
...
...
@@ -46,11 +46,11 @@ public protocol MenuDelegate {
}
open
class
Menu
:
View
{
/// A delegation reference.
open
weak
var
delegate
:
MenuDelegate
?
/// A Boolean that indicates if the menu is open or not.
open
private(set)
var
isOpened
=
false
open
internal(set)
var
isOpened
=
false
/// Enables the animations for the Menu.
open
internal(set)
var
isEnabled
=
true
/// A preset wrapper around interimSpace.
open
var
interimSpacePreset
=
InterimSpacePreset
.
none
{
...
...
@@ -66,9 +66,6 @@ open class Menu: View {
}
}
/// Enables the animations for the Menu.
open
private(set)
var
isEnabled
=
true
/// The direction in which the animation opens the menu.
open
var
direction
=
MenuDirection
.
up
{
didSet
{
...
...
@@ -76,6 +73,9 @@ open class Menu: View {
}
}
/// A delegation reference.
open
weak
var
delegate
:
MenuDelegate
?
/// An Array of UIViews.
open
var
views
=
[
UIView
]()
{
didSet
{
...
...
@@ -86,6 +86,7 @@ open class Menu: View {
for
v
in
views
{
addSubview
(
v
)
}
reload
()
}
}
...
...
Sources/iOS/NavigationDrawerController.swift
View file @
928ba8cb
This diff is collapsed.
Click to expand it.
Sources/iOS/SearchBar.swift
View file @
928ba8cb
...
...
@@ -32,17 +32,17 @@ import UIKit
open
class
SearchBar
:
BarView
{
/// The UITextField for the searchBar.
open
private(set)
var
textField
:
UITextField
!
open
private(set)
lazy
var
textField
=
UITextField
()
/// Reference to the clearButton.
open
private(set)
var
clearButton
:
IconButton
!
/// Handle the clearButton manually.
@IBInspectable
open
var
clearButtonAutoHandleEnabled
:
Bool
=
true
{
open
var
isClearButtonAutoHandleEnabled
=
true
{
didSet
{
clearButton
.
removeTarget
(
self
,
action
:
#selector(
handleClearButton
)
,
for
:
.
touchUpInside
)
if
c
learButtonAutoHandleEnabled
{
if
isC
learButtonAutoHandleEnabled
{
clearButton
.
addTarget
(
self
,
action
:
#selector(
handleClearButton
)
,
for
:
.
touchUpInside
)
}
}
...
...
@@ -82,7 +82,7 @@ open class SearchBar: BarView {
/// Placeholder textColor.
@IBInspectable
open
var
placeholderColor
:
UIColor
=
Color
.
darkText
.
others
{
open
var
placeholderColor
=
Color
.
darkText
.
others
{
didSet
{
if
let
v
:
String
=
placeholder
{
textField
.
attributedPlaceholder
=
NSAttributedString
(
string
:
v
,
attributes
:
[
NSForegroundColorAttributeName
:
placeholderColor
])
...
...
@@ -142,7 +142,7 @@ open class SearchBar: BarView {
/// Layout the clearButton.
open
func
layoutClearButton
()
{
let
h
:
CGFloat
=
textField
.
frame
.
height
let
h
=
textField
.
frame
.
height
clearButton
.
frame
=
CGRect
(
x
:
textField
.
frame
.
width
-
h
,
y
:
0
,
width
:
h
,
height
:
h
)
}
...
...
@@ -154,7 +154,6 @@ open class SearchBar: BarView {
/// Prepares the textField.
private
func
prepareTextField
()
{
textField
=
UITextField
()
textField
.
contentScaleFactor
=
Device
.
scale
textField
.
font
=
RobotoFont
.
regular
(
with
:
17
)
textField
.
backgroundColor
=
Color
.
clear
...
...
@@ -169,7 +168,7 @@ open class SearchBar: BarView {
private
func
prepareClearButton
()
{
clearButton
=
IconButton
(
image
:
Icon
.
cm
.
close
,
tintColor
:
placeholderColor
)
clearButton
.
contentEdgeInsets
=
.
zero
c
learButtonAutoHandleEnabled
=
true
isC
learButtonAutoHandleEnabled
=
true
textField
.
clearButtonMode
=
.
never
textField
.
rightViewMode
=
.
whileEditing
textField
.
rightView
=
clearButton
...
...
Sources/iOS/Switch.swift
View file @
928ba8cb
This diff is collapsed.
Click to expand it.
Sources/iOS/TextField.swift
View file @
928ba8cb
...
...
@@ -40,7 +40,7 @@ open class TextField: UITextField {
}
/// A Boolean that indicates if the TextField is in an animating state.
open
private(set)
var
a
nimating
=
false
open
internal(set)
var
isA
nimating
=
false
/// A property that accesses the backing layer's backgroundColor.
@IBInspectable
...
...
@@ -199,7 +199,7 @@ open class TextField: UITextField {
/// Enables the clearIconButton.
@IBInspectable
open
var
enableClearIconButton
:
Bool
{
open
var
isClearIconButtonEnable
:
Bool
{
get
{
return
nil
!=
clearIconButton
}
...
...
@@ -234,7 +234,7 @@ open class TextField: UITextField {
/// Enables the visibilityIconButton.
@IBInspectable
open
var
enableVisibilityIconButton
:
Bool
{
open
var
isVisibilityIconButtonEnable
:
Bool
{
get
{
return
nil
!=
visibilityIconButton
}
...
...
@@ -379,7 +379,7 @@ open class TextField: UITextField {
/// Ensures that the components are sized correctly.
open
func
layoutToSize
()
{
if
!
a
nimating
{
if
!
isA
nimating
{
layoutPlaceholderLabel
()
layoutDetailLabel
()
layoutClearIconButton
()
...
...
@@ -461,7 +461,7 @@ open class TextField: UITextField {
/// The animation for the placeholder when editing begins.
open
func
placeholderEditingDidBeginAnimation
()
{
if
placeholderLabel
.
transform
.
isIdentity
{
a
nimating
=
true
isA
nimating
=
true
UIView
.
animate
(
withDuration
:
0.15
,
animations
:
{
[
weak
self
]
in
if
let
s
=
self
{
s
.
placeholderLabel
.
transform
=
CGAffineTransform
(
scaleX
:
0.75
,
y
:
0.75
)
...
...
@@ -476,7 +476,7 @@ open class TextField: UITextField {
s
.
placeholderLabel
.
textColor
=
s
.
placeholderActiveColor
}
})
{
[
weak
self
]
_
in
self
?
.
a
nimating
=
false
self
?
.
isA
nimating
=
false
}
}
else
if
isEditing
{
placeholderLabel
.
textColor
=
placeholderActiveColor
...
...
@@ -486,7 +486,7 @@ open class TextField: UITextField {
/// The animation for the placeholder when editing ends.
open
func
placeholderEditingDidEndAnimation
()
{
if
!
placeholderLabel
.
transform
.
isIdentity
&&
true
==
text
?
.
isEmpty
{
a
nimating
=
true
isA
nimating
=
true
UIView
.
animate
(
withDuration
:
0.15
,
animations
:
{
[
weak
self
]
in
if
let
s
=
self
{
s
.
placeholderLabel
.
transform
=
CGAffineTransform
.
identity
...
...
@@ -495,7 +495,7 @@ open class TextField: UITextField {
s
.
placeholderLabel
.
textColor
=
s
.
placeholderColor
}
})
{
[
weak
self
]
_
in
self
?
.
a
nimating
=
false
self
?
.
isA
nimating
=
false
}
}
else
if
!
isEditing
{
placeholderLabel
.
textColor
=
placeholderColor
...
...
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