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
54b91588
Unverified
Commit
54b91588
authored
Sep 26, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated Pulse and Divider to be accessible through Storyboards
parent
ed5c1030
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
372 additions
and
78 deletions
+372
-78
Examples/Programmatic/Bar/Bar/ViewController.swift
+2
-2
Examples/Programmatic/Button/Button/ViewController.swift
+1
-1
Examples/Programmatic/CaptureController/CaptureController/Assets.xcassets/AppIcon.appiconset/Contents.json
+25
-0
Examples/Programmatic/NavigationController/NavigationController/RootViewController.swift
+1
-1
Examples/Programmatic/SnackbarController/SnackbarController/RootViewController.swift
+1
-1
Examples/Programmatic/TabBar/TabBar/ViewController.swift
+3
-3
Examples/Storyboards/Button/Button.xcodeproj/project.pbxproj
+16
-3
Examples/Storyboards/Button/Button/ViewController.swift
+5
-17
Material.xcworkspace/contents.xcworkspacedata
+7
-0
Sources/iOS/Bar.swift
+33
-7
Sources/iOS/BottomTabBar.swift
+34
-2
Sources/iOS/Button.swift
+33
-2
Sources/iOS/Card.swift
+1
-1
Sources/iOS/CollectionReusableView.swift
+32
-1
Sources/iOS/CollectionViewCell.swift
+66
-9
Sources/iOS/FabButton.swift
+2
-2
Sources/iOS/IconButton.swift
+1
-1
Sources/iOS/NavigationBar.swift
+35
-11
Sources/iOS/PageTabBarController.swift
+1
-1
Sources/iOS/Pulse.swift
+4
-6
Sources/iOS/PulseView.swift
+34
-3
Sources/iOS/Switch.swift
+1
-1
Sources/iOS/TableViewCell.swift
+32
-1
Sources/iOS/TextField.swift
+2
-2
No files found.
Examples/Programmatic/Bar/Bar/ViewController.swift
View file @
54b91588
...
@@ -58,12 +58,12 @@ class ViewController: UIViewController {
...
@@ -58,12 +58,12 @@ class ViewController: UIViewController {
private
func
prepareFavoriteButton
()
{
private
func
prepareFavoriteButton
()
{
favoriteButton
=
IconButton
(
image
:
Icon
.
favorite
,
tintColor
:
Color
.
white
)
favoriteButton
=
IconButton
(
image
:
Icon
.
favorite
,
tintColor
:
Color
.
white
)
favoriteButton
.
pulse
.
c
olor
=
Color
.
white
favoriteButton
.
pulse
C
olor
=
Color
.
white
}
}
private
func
prepareShareButton
()
{
private
func
prepareShareButton
()
{
shareButton
=
IconButton
(
image
:
Icon
.
cm
.
share
,
tintColor
:
Color
.
white
)
shareButton
=
IconButton
(
image
:
Icon
.
cm
.
share
,
tintColor
:
Color
.
white
)
shareButton
.
pulse
.
c
olor
=
Color
.
white
shareButton
.
pulse
C
olor
=
Color
.
white
}
}
private
func
prepareTitleLabel
()
{
private
func
prepareTitleLabel
()
{
...
...
Examples/Programmatic/Button/Button/ViewController.swift
View file @
54b91588
...
@@ -80,7 +80,7 @@ class ViewController: UIViewController {
...
@@ -80,7 +80,7 @@ class ViewController: UIViewController {
private
func
prepareRaisedButton
()
{
private
func
prepareRaisedButton
()
{
let
button
=
RaisedButton
(
title
:
"Raised Button"
,
titleColor
:
Color
.
white
)
let
button
=
RaisedButton
(
title
:
"Raised Button"
,
titleColor
:
Color
.
white
)
button
.
pulse
.
c
olor
=
Color
.
white
button
.
pulse
C
olor
=
Color
.
white
button
.
backgroundColor
=
Color
.
blue
.
base
button
.
backgroundColor
=
Color
.
blue
.
base
view
.
layout
(
button
)
view
.
layout
(
button
)
...
...
Examples/Programmatic/CaptureController/CaptureController/Assets.xcassets/AppIcon.appiconset/Contents.json
View file @
54b91588
...
@@ -2,6 +2,16 @@
...
@@ -2,6 +2,16 @@
"images"
:
[
"images"
:
[
{
{
"idiom"
:
"iphone"
,
"idiom"
:
"iphone"
,
"size"
:
"20x20"
,
"scale"
:
"2x"
},
{
"idiom"
:
"iphone"
,
"size"
:
"20x20"
,
"scale"
:
"3x"
},
{
"idiom"
:
"iphone"
,
"size"
:
"29x29"
,
"size"
:
"29x29"
,
"scale"
:
"2x"
"scale"
:
"2x"
},
},
...
@@ -32,6 +42,16 @@
...
@@ -32,6 +42,16 @@
},
},
{
{
"idiom"
:
"ipad"
,
"idiom"
:
"ipad"
,
"size"
:
"20x20"
,
"scale"
:
"1x"
},
{
"idiom"
:
"ipad"
,
"size"
:
"20x20"
,
"scale"
:
"2x"
},
{
"idiom"
:
"ipad"
,
"size"
:
"29x29"
,
"size"
:
"29x29"
,
"scale"
:
"1x"
"scale"
:
"1x"
},
},
...
@@ -59,6 +79,11 @@
...
@@ -59,6 +79,11 @@
"idiom"
:
"ipad"
,
"idiom"
:
"ipad"
,
"size"
:
"76x76"
,
"size"
:
"76x76"
,
"scale"
:
"2x"
"scale"
:
"2x"
},
{
"idiom"
:
"ipad"
,
"size"
:
"83.5x83.5"
,
"scale"
:
"2x"
}
}
],
],
"info"
:
{
"info"
:
{
...
...
Examples/Programmatic/NavigationController/NavigationController/RootViewController.swift
View file @
54b91588
...
@@ -77,7 +77,7 @@ class RootViewController: UIViewController {
...
@@ -77,7 +77,7 @@ class RootViewController: UIViewController {
private
func
prepareNextButton
()
{
private
func
prepareNextButton
()
{
nextButton
=
FlatButton
()
nextButton
=
FlatButton
()
nextButton
.
pulse
.
a
nimation
=
.
none
nextButton
.
pulse
A
nimation
=
.
none
nextButton
.
addTarget
(
self
,
action
:
#selector(
handleNextButton
)
,
for
:
.
touchUpInside
)
nextButton
.
addTarget
(
self
,
action
:
#selector(
handleNextButton
)
,
for
:
.
touchUpInside
)
view
.
layout
(
nextButton
)
.
edges
()
view
.
layout
(
nextButton
)
.
edges
()
}
}
...
...
Examples/Programmatic/SnackbarController/SnackbarController/RootViewController.swift
View file @
54b91588
...
@@ -51,7 +51,7 @@ class RootViewController: UIViewController {
...
@@ -51,7 +51,7 @@ class RootViewController: UIViewController {
private
func
prepareUndoButton
()
{
private
func
prepareUndoButton
()
{
undoButton
=
FlatButton
(
title
:
"Undo"
,
titleColor
:
Color
.
yellow
.
base
)
undoButton
=
FlatButton
(
title
:
"Undo"
,
titleColor
:
Color
.
yellow
.
base
)
undoButton
.
pulse
.
a
nimation
=
.
backing
undoButton
.
pulse
A
nimation
=
.
backing
undoButton
.
titleLabel
?
.
font
=
RobotoFont
.
regular
(
with
:
14
)
undoButton
.
titleLabel
?
.
font
=
RobotoFont
.
regular
(
with
:
14
)
}
}
...
...
Examples/Programmatic/TabBar/TabBar/ViewController.swift
View file @
54b91588
...
@@ -48,15 +48,15 @@ class ViewController: UIViewController {
...
@@ -48,15 +48,15 @@ class ViewController: UIViewController {
private
func
prepareButtons
()
{
private
func
prepareButtons
()
{
let
btn1
=
FlatButton
(
title
:
"Library"
,
titleColor
:
Color
.
blueGrey
.
base
)
let
btn1
=
FlatButton
(
title
:
"Library"
,
titleColor
:
Color
.
blueGrey
.
base
)
btn1
.
pulse
.
a
nimation
=
.
none
btn1
.
pulse
A
nimation
=
.
none
buttons
.
append
(
btn1
)
buttons
.
append
(
btn1
)
let
btn2
=
FlatButton
(
title
:
"Photo"
,
titleColor
:
Color
.
blueGrey
.
base
)
let
btn2
=
FlatButton
(
title
:
"Photo"
,
titleColor
:
Color
.
blueGrey
.
base
)
btn2
.
pulse
.
a
nimation
=
.
none
btn2
.
pulse
A
nimation
=
.
none
buttons
.
append
(
btn2
)
buttons
.
append
(
btn2
)
let
btn3
=
FlatButton
(
title
:
"Video"
,
titleColor
:
Color
.
blueGrey
.
base
)
let
btn3
=
FlatButton
(
title
:
"Video"
,
titleColor
:
Color
.
blueGrey
.
base
)
btn3
.
pulse
.
a
nimation
=
.
none
btn3
.
pulse
A
nimation
=
.
none
buttons
.
append
(
btn3
)
buttons
.
append
(
btn3
)
}
}
...
...
Examples/Storyboards/Button/Button.xcodeproj/project.pbxproj
View file @
54b91588
...
@@ -14,6 +14,19 @@
...
@@ -14,6 +14,19 @@
9A0572981D99E64100341332
/* LaunchScreen.storyboard in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A0572961D99E64100341332
/* LaunchScreen.storyboard */
;
};
9A0572981D99E64100341332
/* LaunchScreen.storyboard in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A0572961D99E64100341332
/* LaunchScreen.storyboard */
;
};
/* End PBXBuildFile section */
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
9690B4151D99FF2700E7F42A
/* Embed Frameworks */
=
{
isa
=
PBXCopyFilesBuildPhase
;
buildActionMask
=
2147483647
;
dstPath
=
""
;
dstSubfolderSpec
=
10
;
files
=
(
);
name
=
"Embed Frameworks"
;
runOnlyForDeploymentPostprocessing
=
0
;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
/* Begin PBXFileReference section */
9A05728A1D99E64100341332
/* Button.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
Button.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
9A05728A1D99E64100341332
/* Button.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
Button.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
9A05728D1D99E64100341332
/* AppDelegate.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppDelegate.swift
;
sourceTree
=
"<group>"
;
};
9A05728D1D99E64100341332
/* AppDelegate.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppDelegate.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -74,6 +87,7 @@
...
@@ -74,6 +87,7 @@
9A0572861D99E64100341332
/* Sources */
,
9A0572861D99E64100341332
/* Sources */
,
9A0572871D99E64100341332
/* Frameworks */
,
9A0572871D99E64100341332
/* Frameworks */
,
9A0572881D99E64100341332
/* Resources */
,
9A0572881D99E64100341332
/* Resources */
,
9690B4151D99FF2700E7F42A
/* Embed Frameworks */
,
);
);
buildRules
=
(
buildRules
=
(
);
);
...
@@ -96,7 +110,6 @@
...
@@ -96,7 +110,6 @@
TargetAttributes
=
{
TargetAttributes
=
{
9A0572891D99E64100341332
=
{
9A0572891D99E64100341332
=
{
CreatedOnToolsVersion
=
8.0
;
CreatedOnToolsVersion
=
8.0
;
DevelopmentTeam
=
5YZ5P93LKC
;
ProvisioningStyle
=
Automatic
;
ProvisioningStyle
=
Automatic
;
};
};
};
};
...
@@ -259,7 +272,7 @@
...
@@ -259,7 +272,7 @@
isa
=
XCBuildConfiguration
;
isa
=
XCBuildConfiguration
;
buildSettings
=
{
buildSettings
=
{
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
DEVELOPMENT_TEAM
=
5YZ5P93LKC
;
DEVELOPMENT_TEAM
=
""
;
INFOPLIST_FILE
=
Button/Info.plist
;
INFOPLIST_FILE
=
Button/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks"
;
PRODUCT_BUNDLE_IDENTIFIER
=
com.cosmicmind.Button
;
PRODUCT_BUNDLE_IDENTIFIER
=
com.cosmicmind.Button
;
...
@@ -272,7 +285,7 @@
...
@@ -272,7 +285,7 @@
isa
=
XCBuildConfiguration
;
isa
=
XCBuildConfiguration
;
buildSettings
=
{
buildSettings
=
{
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
ASSETCATALOG_COMPILER_APPICON_NAME
=
AppIcon
;
DEVELOPMENT_TEAM
=
5YZ5P93LKC
;
DEVELOPMENT_TEAM
=
""
;
INFOPLIST_FILE
=
Button/Info.plist
;
INFOPLIST_FILE
=
Button/Info.plist
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks"
;
PRODUCT_BUNDLE_IDENTIFIER
=
com.cosmicmind.Button
;
PRODUCT_BUNDLE_IDENTIFIER
=
com.cosmicmind.Button
;
...
...
Examples/Storyboards/Button/Button/ViewController.swift
View file @
54b91588
...
@@ -32,36 +32,24 @@ import UIKit
...
@@ -32,36 +32,24 @@ import UIKit
import
Material
import
Material
class
ViewController
:
UIViewController
{
class
ViewController
:
UIViewController
{
// ivars
@IBOutlet
weak
var
fabButton
:
FabButton
!
@IBOutlet
weak
var
fabButton
:
FabButton
!
@IBOutlet
weak
var
iconButton
:
IconButton
!
@IBOutlet
weak
var
iconButton
:
IconButton
!
/**
@name viewDidLoad()
*/
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
prepareFabButton
()
prepareFabButton
()
prepareIconButton
()
prepareIconButton
()
}
}
}
// Preparation
extension
ViewController
{
/**
@name prepareFabButton()
*/
func
prepareFabButton
()
{
func
prepareFabButton
()
{
fabButton
.
setImage
(
Icon
.
edit
,
for
:
.
normal
)
fabButton
.
image
=
Icon
.
cm
.
add
fabButton
.
pulseColor
=
Color
.
white
}
}
/**
@name prepareIconButton()
*/
func
prepareIconButton
()
{
func
prepareIconButton
()
{
iconButton
.
setImage
(
Icon
.
search
,
for
:
.
normal
)
iconButton
.
image
=
Icon
.
search
iconButton
.
pulseColor
=
Color
.
blue
.
base
}
}
}
}
Material.xcworkspace/contents.xcworkspacedata
View file @
54b91588
...
@@ -74,5 +74,12 @@
...
@@ -74,5 +74,12 @@
location =
"group:Examples/Programmatic/View/View.xcodeproj"
>
location =
"group:Examples/Programmatic/View/View.xcodeproj"
>
</FileRef>
</FileRef>
</Group>
</Group>
<Group
location =
"container:"
name =
"Storyboards"
>
<FileRef
location =
"group:Examples/Storyboards/Button/Button.xcodeproj"
>
</FileRef>
</Group>
</Group>
</Group>
</Workspace>
</Workspace>
Sources/iOS/Bar.swift
View file @
54b91588
...
@@ -102,7 +102,39 @@ open class Bar: View {
...
@@ -102,7 +102,39 @@ open class Bar: View {
}
}
/// Divider layer.
/// Divider layer.
open
internal(set)
var
divider
:
Divider
!
internal
lazy
var
divider
:
Divider
=
Divider
(
view
:
self
)
/// Divider color.
@IBInspectable
open
var
dividerColor
:
UIColor
?
{
get
{
return
divider
.
color
}
set
(
value
)
{
divider
.
color
=
value
}
}
/// Divider animation.
open
var
dividerAlignment
:
DividerAlignment
{
get
{
return
divider
.
alignment
}
set
(
value
)
{
divider
.
alignment
=
value
}
}
/// Divider height.
@IBInspectable
open
var
dividerHeight
:
CGFloat
{
get
{
return
divider
.
height
}
set
(
value
)
{
divider
.
height
=
value
}
}
/// ContentView that holds the any desired subviews.
/// ContentView that holds the any desired subviews.
open
private(set)
lazy
var
contentView
=
View
()
open
private(set)
lazy
var
contentView
=
View
()
...
@@ -233,16 +265,10 @@ open class Bar: View {
...
@@ -233,16 +265,10 @@ open class Bar: View {
open
override
func
prepare
()
{
open
override
func
prepare
()
{
super
.
prepare
()
super
.
prepare
()
prepareContentView
()
prepareContentView
()
prepareDivider
()
}
}
/// Prepares the contentView.
/// Prepares the contentView.
private
func
prepareContentView
()
{
private
func
prepareContentView
()
{
contentView
.
backgroundColor
=
nil
contentView
.
backgroundColor
=
nil
}
}
/// Prepares the divider.
private
func
prepareDivider
()
{
divider
=
Divider
(
view
:
self
)
}
}
}
Sources/iOS/BottomTabBar.swift
View file @
54b91588
...
@@ -123,7 +123,7 @@ open class BottomTabBar: UITabBar {
...
@@ -123,7 +123,7 @@ open class BottomTabBar: UITabBar {
*/
*/
public
func
prepare
()
{
public
func
prepare
()
{
depthPreset
=
.
depth1
depthPreset
=
.
depth1
divider
.
a
lignment
=
.
top
divider
A
lignment
=
.
top
contentScaleFactor
=
Device
.
scale
contentScaleFactor
=
Device
.
scale
backgroundColor
=
Color
.
white
backgroundColor
=
Color
.
white
let
image
=
UIImage
.
imageWithColor
(
color
:
Color
.
clear
,
size
:
CGSize
(
width
:
1
,
height
:
1
))
let
image
=
UIImage
.
imageWithColor
(
color
:
Color
.
clear
,
size
:
CGSize
(
width
:
1
,
height
:
1
))
...
@@ -137,7 +137,7 @@ private var TabBarKey: UInt8 = 0
...
@@ -137,7 +137,7 @@ private var TabBarKey: UInt8 = 0
extension
UITabBar
{
extension
UITabBar
{
/// TabBarItem reference.
/// TabBarItem reference.
public
internal
(set)
var
divider
:
Divider
!
{
internal
private
(set)
var
divider
:
Divider
!
{
get
{
get
{
return
AssociatedObject
(
base
:
self
,
key
:
&
TabBarKey
)
{
return
AssociatedObject
(
base
:
self
,
key
:
&
TabBarKey
)
{
return
Divider
(
view
:
self
)
return
Divider
(
view
:
self
)
...
@@ -147,5 +147,37 @@ extension UITabBar {
...
@@ -147,5 +147,37 @@ extension UITabBar {
AssociateObject
(
base
:
self
,
key
:
&
TabBarKey
,
value
:
value
)
AssociateObject
(
base
:
self
,
key
:
&
TabBarKey
,
value
:
value
)
}
}
}
}
/// Divider color.
@IBInspectable
open
var
dividerColor
:
UIColor
?
{
get
{
return
divider
.
color
}
set
(
value
)
{
divider
.
color
=
value
}
}
/// Divider animation.
open
var
dividerAlignment
:
DividerAlignment
{
get
{
return
divider
.
alignment
}
set
(
value
)
{
divider
.
alignment
=
value
}
}
/// Divider height.
@IBInspectable
open
var
dividerHeight
:
CGFloat
{
get
{
return
divider
.
height
}
set
(
value
)
{
divider
.
height
=
value
}
}
}
}
Sources/iOS/Button.swift
View file @
54b91588
...
@@ -41,9 +41,40 @@ open class Button: UIButton {
...
@@ -41,9 +41,40 @@ open class Button: UIButton {
open
private(set)
lazy
var
visualLayer
=
CAShapeLayer
()
open
private(set)
lazy
var
visualLayer
=
CAShapeLayer
()
/// A Pulse reference.
/// A Pulse reference.
@IBInspectable
internal
private(set)
lazy
var
pulse
:
Pulse
=
Pulse
()
open
internal(set)
lazy
var
pulse
:
Pulse
=
Pulse
()
/// PulseAnimation value.
open
var
pulseAnimation
:
PulseAnimation
{
get
{
return
pulse
.
animation
}
set
(
value
)
{
pulse
.
animation
=
value
}
}
/// PulseAnimation color.
@IBInspectable
open
var
pulseColor
:
UIColor
{
get
{
return
pulse
.
color
}
set
(
value
)
{
pulse
.
color
=
value
}
}
/// Pulse opacity.
@IBInspectable
open
var
pulseOpacity
:
CGFloat
{
get
{
return
pulse
.
opacity
}
set
(
value
)
{
pulse
.
opacity
=
value
}
}
/// A property that accesses the backing layer's backgroundColor.
/// A property that accesses the backing layer's backgroundColor.
@IBInspectable
@IBInspectable
open
override
var
backgroundColor
:
UIColor
?
{
open
override
var
backgroundColor
:
UIColor
?
{
...
...
Sources/iOS/Card.swift
View file @
54b91588
...
@@ -180,7 +180,7 @@ open class Card: PulseView {
...
@@ -180,7 +180,7 @@ open class Card: PulseView {
open
override
func
prepare
()
{
open
override
func
prepare
()
{
super
.
prepare
()
super
.
prepare
()
depthPreset
=
.
depth1
depthPreset
=
.
depth1
pulse
.
a
nimation
=
.
none
pulse
A
nimation
=
.
none
}
}
/**
/**
...
...
Sources/iOS/CollectionReusableView.swift
View file @
54b91588
...
@@ -41,8 +41,39 @@ open class CollectionReusableView: UICollectionReusableView {
...
@@ -41,8 +41,39 @@ open class CollectionReusableView: UICollectionReusableView {
open
private(set)
lazy
var
visualLayer
=
CAShapeLayer
()
open
private(set)
lazy
var
visualLayer
=
CAShapeLayer
()
/// A Pulse reference.
/// A Pulse reference.
internal
private(set)
lazy
var
pulse
:
Pulse
=
Pulse
()
/// PulseAnimation value.
open
var
pulseAnimation
:
PulseAnimation
{
get
{
return
pulse
.
animation
}
set
(
value
)
{
pulse
.
animation
=
value
}
}
/// PulseAnimation color.
@IBInspectable
@IBInspectable
open
internal(set)
lazy
var
pulse
:
Pulse
=
Pulse
()
open
var
pulseColor
:
UIColor
{
get
{
return
pulse
.
color
}
set
(
value
)
{
pulse
.
color
=
value
}
}
/// Pulse opacity.
@IBInspectable
open
var
pulseOpacity
:
CGFloat
{
get
{
return
pulse
.
opacity
}
set
(
value
)
{
pulse
.
opacity
=
value
}
}
/**
/**
A property that manages an image for the visualLayer's contents
A property that manages an image for the visualLayer's contents
...
...
Sources/iOS/CollectionViewCell.swift
View file @
54b91588
...
@@ -32,8 +32,40 @@ import UIKit
...
@@ -32,8 +32,40 @@ import UIKit
@objc(CollectionViewCell)
@objc(CollectionViewCell)
open
class
CollectionViewCell
:
UICollectionViewCell
{
open
class
CollectionViewCell
:
UICollectionViewCell
{
/// A reference to the divider.
/// Divider layer.
open
internal(set)
var
divider
:
Divider
!
internal
private(set)
lazy
var
divider
:
Divider
=
Divider
(
view
:
self
)
/// Divider color.
@IBInspectable
open
var
dividerColor
:
UIColor
?
{
get
{
return
divider
.
color
}
set
(
value
)
{
divider
.
color
=
value
}
}
/// Divider animation.
open
var
dividerAlignment
:
DividerAlignment
{
get
{
return
divider
.
alignment
}
set
(
value
)
{
divider
.
alignment
=
value
}
}
/// Divider height.
@IBInspectable
open
var
dividerHeight
:
CGFloat
{
get
{
return
divider
.
height
}
set
(
value
)
{
divider
.
height
=
value
}
}
/**
/**
A CAShapeLayer used to manage elements that would be affected by
A CAShapeLayer used to manage elements that would be affected by
...
@@ -44,8 +76,39 @@ open class CollectionViewCell: UICollectionViewCell {
...
@@ -44,8 +76,39 @@ open class CollectionViewCell: UICollectionViewCell {
open
private(set)
lazy
var
visualLayer
=
CAShapeLayer
()
open
private(set)
lazy
var
visualLayer
=
CAShapeLayer
()
/// A Pulse reference.
/// A Pulse reference.
internal
private(set)
lazy
var
pulse
:
Pulse
=
Pulse
()
/// PulseAnimation value.
open
var
pulseAnimation
:
PulseAnimation
{
get
{
return
pulse
.
animation
}
set
(
value
)
{
pulse
.
animation
=
value
}
}
/// PulseAnimation color.
@IBInspectable
open
var
pulseColor
:
UIColor
{
get
{
return
pulse
.
color
}
set
(
value
)
{
pulse
.
color
=
value
}
}
/// Pulse opacity.
@IBInspectable
@IBInspectable
open
internal(set)
lazy
var
pulse
:
Pulse
=
Pulse
()
open
var
pulseOpacity
:
CGFloat
{
get
{
return
pulse
.
opacity
}
set
(
value
)
{
pulse
.
opacity
=
value
}
}
/**
/**
A property that manages an image for the visualLayer's contents
A property that manages an image for the visualLayer's contents
...
@@ -268,7 +331,6 @@ open class CollectionViewCell: UICollectionViewCell {
...
@@ -268,7 +331,6 @@ open class CollectionViewCell: UICollectionViewCell {
open
func
prepare
()
{
open
func
prepare
()
{
contentScaleFactor
=
Device
.
scale
contentScaleFactor
=
Device
.
scale
prepareVisualLayer
()
prepareVisualLayer
()
prepareDivider
()
}
}
/// Prepares the visualLayer property.
/// Prepares the visualLayer property.
...
@@ -283,9 +345,4 @@ open class CollectionViewCell: UICollectionViewCell {
...
@@ -283,9 +345,4 @@ open class CollectionViewCell: UICollectionViewCell {
visualLayer
.
frame
=
bounds
visualLayer
.
frame
=
bounds
visualLayer
.
cornerRadius
=
cornerRadius
visualLayer
.
cornerRadius
=
cornerRadius
}
}
/// Prepares the divider.
private
func
prepareDivider
()
{
divider
=
Divider
(
view
:
self
)
}
}
}
Sources/iOS/FabButton.swift
View file @
54b91588
...
@@ -42,8 +42,8 @@ open class FabButton: Button {
...
@@ -42,8 +42,8 @@ open class FabButton: Button {
super
.
prepare
()
super
.
prepare
()
depthPreset
=
.
depth1
depthPreset
=
.
depth1
shapePreset
=
.
circle
shapePreset
=
.
circle
pulse
.
a
nimation
=
.
centerWithBacking
pulse
A
nimation
=
.
centerWithBacking
pulse
.
c
olor
=
Color
.
white
pulse
C
olor
=
Color
.
white
tintColor
=
Color
.
white
tintColor
=
Color
.
white
backgroundColor
=
Color
.
red
.
base
backgroundColor
=
Color
.
red
.
base
}
}
...
...
Sources/iOS/IconButton.swift
View file @
54b91588
...
@@ -40,6 +40,6 @@ open class IconButton: Button {
...
@@ -40,6 +40,6 @@ open class IconButton: Button {
*/
*/
open
override
func
prepare
()
{
open
override
func
prepare
()
{
super
.
prepare
()
super
.
prepare
()
pulse
.
a
nimation
=
.
center
pulse
A
nimation
=
.
center
}
}
}
}
Sources/iOS/NavigationBar.swift
View file @
54b91588
...
@@ -39,8 +39,40 @@ public enum NavigationBarStyle: Int {
...
@@ -39,8 +39,40 @@ public enum NavigationBarStyle: Int {
}
}
open
class
NavigationBar
:
UINavigationBar
{
open
class
NavigationBar
:
UINavigationBar
{
/// A reference to the divider.
/// Divider layer.
open
internal(set)
var
divider
:
Divider
!
internal
private(set)
lazy
var
divider
:
Divider
=
Divider
(
view
:
self
)
/// Divider color.
@IBInspectable
open
var
dividerColor
:
UIColor
?
{
get
{
return
divider
.
color
}
set
(
value
)
{
divider
.
color
=
value
}
}
/// Divider animation.
open
var
dividerAlignment
:
DividerAlignment
{
get
{
return
divider
.
alignment
}
set
(
value
)
{
divider
.
alignment
=
value
}
}
/// Divider height.
@IBInspectable
open
var
dividerHeight
:
CGFloat
{
get
{
return
divider
.
height
}
set
(
value
)
{
divider
.
height
=
value
}
}
open
override
var
intrinsicContentSize
:
CGSize
{
open
override
var
intrinsicContentSize
:
CGSize
{
switch
navigationBarStyle
{
switch
navigationBarStyle
{
...
@@ -174,9 +206,7 @@ open class NavigationBar: UINavigationBar {
...
@@ -174,9 +206,7 @@ open class NavigationBar: UINavigationBar {
layoutNavigationItem
(
item
:
v
)
layoutNavigationItem
(
item
:
v
)
}
}
if
let
v
=
divider
{
divider
.
reload
()
v
.
reload
()
}
}
}
open
override
func
pushItem
(
_
item
:
UINavigationItem
,
animated
:
Bool
)
{
open
override
func
pushItem
(
_
item
:
UINavigationItem
,
animated
:
Bool
)
{
...
@@ -305,7 +335,6 @@ open class NavigationBar: UINavigationBar {
...
@@ -305,7 +335,6 @@ open class NavigationBar: UINavigationBar {
shadowImage
=
image
shadowImage
=
image
setBackgroundImage
(
image
,
for
:
.
default
)
setBackgroundImage
(
image
,
for
:
.
default
)
backgroundColor
=
Color
.
white
backgroundColor
=
Color
.
white
prepareDivider
()
}
}
/**
/**
...
@@ -327,9 +356,4 @@ open class NavigationBar: UINavigationBar {
...
@@ -327,9 +356,4 @@ open class NavigationBar: UINavigationBar {
}
}
item
.
titleView
=
UIView
(
frame
:
.
zero
)
item
.
titleView
=
UIView
(
frame
:
.
zero
)
}
}
/// Prepares the divider.
private
func
prepareDivider
()
{
divider
=
Divider
(
view
:
self
)
}
}
}
Sources/iOS/PageTabBarController.swift
View file @
54b91588
...
@@ -36,7 +36,7 @@ private var PageTabBarItemKey: UInt8 = 0
...
@@ -36,7 +36,7 @@ private var PageTabBarItemKey: UInt8 = 0
open
class
PageTabBarItem
:
FlatButton
{
open
class
PageTabBarItem
:
FlatButton
{
open
override
func
prepare
()
{
open
override
func
prepare
()
{
super
.
prepare
()
super
.
prepare
()
pulse
.
a
nimation
=
.
none
pulse
A
nimation
=
.
none
}
}
}
}
...
...
Sources/iOS/Pulse.swift
View file @
54b91588
...
@@ -30,18 +30,16 @@
...
@@ -30,18 +30,16 @@
import
UIKit
import
UIKit
open
class
Pulse
{
internal
struct
Pulse
{
/// An Array of layers.
/// An Array of layers.
internal
lazy
var
layers
=
[
CAShapeLayer
]()
internal
lazy
var
layers
=
[
CAShapeLayer
]()
/// A UIColor.
/// A UIColor.
@IBInspectable
internal
var
color
=
Color
.
grey
.
base
open
var
color
=
Color
.
grey
.
base
/// A reference to the PulseAnimation.
/// A reference to the PulseAnimation.
open
var
animation
=
PulseAnimation
.
pointWithBacking
internal
var
animation
=
PulseAnimation
.
pointWithBacking
/// The opcaity value for the pulse animation.
/// The opcaity value for the pulse animation.
@IBInspectable
internal
var
opacity
:
CGFloat
=
0.18
open
var
opacity
:
CGFloat
=
0.18
}
}
Sources/iOS/PulseView.swift
View file @
54b91588
...
@@ -31,9 +31,40 @@
...
@@ -31,9 +31,40 @@
import
UIKit
import
UIKit
open
class
PulseView
:
View
{
open
class
PulseView
:
View
{
/// A Pulse reference.
/// A Pulse reference.
@IBInspectable
internal
private(set)
lazy
var
pulse
:
Pulse
=
Pulse
()
open
internal(set)
lazy
var
pulse
:
Pulse
=
Pulse
()
/// PulseAnimation value.
open
var
pulseAnimation
:
PulseAnimation
{
get
{
return
pulse
.
animation
}
set
(
value
)
{
pulse
.
animation
=
value
}
}
/// PulseAnimation color.
@IBInspectable
open
var
pulseColor
:
UIColor
{
get
{
return
pulse
.
color
}
set
(
value
)
{
pulse
.
color
=
value
}
}
/// Pulse opacity.
@IBInspectable
open
var
pulseOpacity
:
CGFloat
{
get
{
return
pulse
.
opacity
}
set
(
value
)
{
pulse
.
opacity
=
value
}
}
/**
/**
Triggers the pulse animation.
Triggers the pulse animation.
...
...
Sources/iOS/Switch.swift
View file @
54b91588
...
@@ -413,7 +413,7 @@ open class Switch: UIControl {
...
@@ -413,7 +413,7 @@ open class Switch: UIControl {
/// Prepares the button.
/// Prepares the button.
private
func
prepareButton
()
{
private
func
prepareButton
()
{
button
.
pulse
.
a
nimation
=
.
none
button
.
pulse
A
nimation
=
.
none
button
.
addTarget
(
self
,
action
:
#selector(
handleTouchUpInside
)
,
for
:
.
touchUpInside
)
button
.
addTarget
(
self
,
action
:
#selector(
handleTouchUpInside
)
,
for
:
.
touchUpInside
)
button
.
addTarget
(
self
,
action
:
#selector(
handleTouchDragInside
)
,
for
:
.
touchDragInside
)
button
.
addTarget
(
self
,
action
:
#selector(
handleTouchDragInside
)
,
for
:
.
touchDragInside
)
button
.
addTarget
(
self
,
action
:
#selector(
handleTouchUpOutsideOrCanceled
)
,
for
:
.
touchCancel
)
button
.
addTarget
(
self
,
action
:
#selector(
handleTouchUpOutsideOrCanceled
)
,
for
:
.
touchCancel
)
...
...
Sources/iOS/TableViewCell.swift
View file @
54b91588
...
@@ -40,8 +40,39 @@ open class TableViewCell: UITableViewCell {
...
@@ -40,8 +40,39 @@ open class TableViewCell: UITableViewCell {
open
private(set)
lazy
var
visualLayer
=
CAShapeLayer
()
open
private(set)
lazy
var
visualLayer
=
CAShapeLayer
()
/// A Pulse reference.
/// A Pulse reference.
internal
private(set)
lazy
var
pulse
:
Pulse
=
Pulse
()
/// PulseAnimation value.
open
var
pulseAnimation
:
PulseAnimation
{
get
{
return
pulse
.
animation
}
set
(
value
)
{
pulse
.
animation
=
value
}
}
/// PulseAnimation color.
@IBInspectable
@IBInspectable
open
internal(set)
lazy
var
pulse
:
Pulse
=
Pulse
()
open
var
pulseColor
:
UIColor
{
get
{
return
pulse
.
color
}
set
(
value
)
{
pulse
.
color
=
value
}
}
/// Pulse opacity.
@IBInspectable
open
var
pulseOpacity
:
CGFloat
{
get
{
return
pulse
.
opacity
}
set
(
value
)
{
pulse
.
opacity
=
value
}
}
/// A property that accesses the backing layer's backgroundColor.
/// A property that accesses the backing layer's backgroundColor.
@IBInspectable
@IBInspectable
...
...
Sources/iOS/TextField.swift
View file @
54b91588
...
@@ -207,7 +207,7 @@ open class TextField: UITextField {
...
@@ -207,7 +207,7 @@ open class TextField: UITextField {
if
nil
==
clearIconButton
{
if
nil
==
clearIconButton
{
clearIconButton
=
IconButton
(
image
:
Icon
.
cm
.
clear
,
tintColor
:
placeholderColor
)
clearIconButton
=
IconButton
(
image
:
Icon
.
cm
.
clear
,
tintColor
:
placeholderColor
)
clearIconButton
!.
contentEdgeInsets
=
.
zero
clearIconButton
!.
contentEdgeInsets
=
.
zero
clearIconButton
!.
pulse
.
a
nimation
=
.
center
clearIconButton
!.
pulse
A
nimation
=
.
center
clearButtonMode
=
.
never
clearButtonMode
=
.
never
rightViewMode
=
.
whileEditing
rightViewMode
=
.
whileEditing
rightView
=
clearIconButton
rightView
=
clearIconButton
...
@@ -242,7 +242,7 @@ open class TextField: UITextField {
...
@@ -242,7 +242,7 @@ open class TextField: UITextField {
if
nil
==
visibilityIconButton
{
if
nil
==
visibilityIconButton
{
visibilityIconButton
=
IconButton
(
image
:
Icon
.
visibility
,
tintColor
:
placeholderColor
.
withAlphaComponent
(
isSecureTextEntry
?
0.38
:
0.54
))
visibilityIconButton
=
IconButton
(
image
:
Icon
.
visibility
,
tintColor
:
placeholderColor
.
withAlphaComponent
(
isSecureTextEntry
?
0.38
:
0.54
))
visibilityIconButton
!.
contentEdgeInsets
=
.
zero
visibilityIconButton
!.
contentEdgeInsets
=
.
zero
visibilityIconButton
!.
pulse
.
a
nimation
=
.
center
visibilityIconButton
!.
pulse
A
nimation
=
.
center
isSecureTextEntry
=
true
isSecureTextEntry
=
true
clearButtonMode
=
.
never
clearButtonMode
=
.
never
rightViewMode
=
.
whileEditing
rightViewMode
=
.
whileEditing
...
...
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