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
d2cb2d46
Commit
d2cb2d46
authored
Jul 14, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
progression commit
parent
ac53a489
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
185 additions
and
89 deletions
+185
-89
Material.xcodeproj/project.pbxproj
+12
-1
Material.xcodeproj/xcshareddata/xcschemes/Material iOS.xcscheme
+1
-1
Sources/iOS/BottomNavigationController.swift
+1
-1
Sources/iOS/BottomTabBar.swift
+15
-15
Sources/iOS/Button.swift
+1
-1
Sources/iOS/Depth.swift
+7
-12
Sources/iOS/Direction.swift
+36
-0
Sources/iOS/Grid.swift
+4
-4
Sources/iOS/IconButton.swift
+1
-1
Sources/iOS/Material+UIImage+TintColor.swift
+11
-9
Sources/iOS/MaterialAnimation.swift
+1
-1
Sources/iOS/MaterialPulseAnimation.swift
+50
-37
Sources/iOS/Menu.swift
+0
-0
Sources/iOS/NavigationDrawerController.swift
+2
-2
Sources/iOS/Offset.swift
+39
-0
Sources/iOS/RootController.swift
+2
-2
Sources/iOS/TabBar.swift
+1
-1
Sources/iOS/View.swift
+1
-1
No files found.
Material.xcodeproj/project.pbxproj
View file @
d2cb2d46
...
@@ -17,6 +17,8 @@
...
@@ -17,6 +17,8 @@
9679CEAB1CC69E080021685B
/* Material+UIImage+TintColor.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9679CEAA1CC69E080021685B
/* Material+UIImage+TintColor.swift */
;
};
9679CEAB1CC69E080021685B
/* Material+UIImage+TintColor.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9679CEAA1CC69E080021685B
/* Material+UIImage+TintColor.swift */
;
};
967A48191D0F425A00B8CEB7
/* StatusBarController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
967A48181D0F425A00B8CEB7
/* StatusBarController.swift */
;
};
967A48191D0F425A00B8CEB7
/* StatusBarController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
967A48181D0F425A00B8CEB7
/* StatusBarController.swift */
;
};
96815B381CA07BA20006CBE2
/* MaterialViewTests.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
967887881C9777CB0037F6C9
/* MaterialViewTests.swift */
;
};
96815B381CA07BA20006CBE2
/* MaterialViewTests.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
967887881C9777CB0037F6C9
/* MaterialViewTests.swift */
;
};
968C99451D37730B000074FF
/* Direction.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
968C99441D37730B000074FF
/* Direction.swift */
;
};
968C99471D377849000074FF
/* Offset.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
968C99461D377849000074FF
/* Offset.swift */
;
};
96977DA61CBB2E49000BEFC4
/* Material+UIImage+FilterBlur.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96977DA51CBB2E49000BEFC4
/* Material+UIImage+FilterBlur.swift */
;
};
96977DA61CBB2E49000BEFC4
/* Material+UIImage+FilterBlur.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96977DA51CBB2E49000BEFC4
/* Material+UIImage+FilterBlur.swift */
;
};
96BCB7A11CB40DC500C806FE
/* BottomNavigationController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7581CB40DC500C806FE
/* BottomNavigationController.swift */
;
};
96BCB7A11CB40DC500C806FE
/* BottomNavigationController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7581CB40DC500C806FE
/* BottomNavigationController.swift */
;
};
96BCB7A21CB40DC500C806FE
/* BottomTabBar.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7591CB40DC500C806FE
/* BottomTabBar.swift */
;
};
96BCB7A21CB40DC500C806FE
/* BottomTabBar.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7591CB40DC500C806FE
/* BottomTabBar.swift */
;
};
...
@@ -208,6 +210,8 @@
...
@@ -208,6 +210,8 @@
967887881C9777CB0037F6C9
/* MaterialViewTests.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialViewTests.swift
;
sourceTree
=
"<group>"
;
};
967887881C9777CB0037F6C9
/* MaterialViewTests.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialViewTests.swift
;
sourceTree
=
"<group>"
;
};
9679CEAA1CC69E080021685B
/* Material+UIImage+TintColor.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIImage+TintColor.swift"
;
sourceTree
=
"<group>"
;
};
9679CEAA1CC69E080021685B
/* Material+UIImage+TintColor.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIImage+TintColor.swift"
;
sourceTree
=
"<group>"
;
};
967A48181D0F425A00B8CEB7
/* StatusBarController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
StatusBarController.swift
;
sourceTree
=
"<group>"
;
};
967A48181D0F425A00B8CEB7
/* StatusBarController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
StatusBarController.swift
;
sourceTree
=
"<group>"
;
};
968C99441D37730B000074FF
/* Direction.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Direction.swift
;
sourceTree
=
"<group>"
;
};
968C99461D377849000074FF
/* Offset.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Offset.swift
;
sourceTree
=
"<group>"
;
};
96977DA51CBB2E49000BEFC4
/* Material+UIImage+FilterBlur.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIImage+FilterBlur.swift"
;
sourceTree
=
"<group>"
;
};
96977DA51CBB2E49000BEFC4
/* Material+UIImage+FilterBlur.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
"Material+UIImage+FilterBlur.swift"
;
sourceTree
=
"<group>"
;
};
96BCB7581CB40DC500C806FE
/* BottomNavigationController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BottomNavigationController.swift
;
sourceTree
=
"<group>"
;
};
96BCB7581CB40DC500C806FE
/* BottomNavigationController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BottomNavigationController.swift
;
sourceTree
=
"<group>"
;
};
96BCB7591CB40DC500C806FE
/* BottomTabBar.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BottomTabBar.swift
;
sourceTree
=
"<group>"
;
};
96BCB7591CB40DC500C806FE
/* BottomTabBar.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BottomTabBar.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -538,6 +542,8 @@
...
@@ -538,6 +542,8 @@
96BCB77C1CB40DC500C806FE
/* MaterialGravity.swift */
,
96BCB77C1CB40DC500C806FE
/* MaterialGravity.swift */
,
96BCB7851CB40DC500C806FE
/* MaterialRadius.swift */
,
96BCB7851CB40DC500C806FE
/* MaterialRadius.swift */
,
96BCB7861CB40DC500C806FE
/* MaterialShape.swift */
,
96BCB7861CB40DC500C806FE
/* MaterialShape.swift */
,
968C99441D37730B000074FF
/* Direction.swift */
,
968C99461D377849000074FF
/* Offset.swift */
,
);
);
name
=
Type
;
name
=
Type
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -825,7 +831,7 @@
...
@@ -825,7 +831,7 @@
attributes
=
{
attributes
=
{
LastSwiftMigration
=
0710
;
LastSwiftMigration
=
0710
;
LastSwiftUpdateCheck
=
0730
;
LastSwiftUpdateCheck
=
0730
;
LastUpgradeCheck
=
0
7
00
;
LastUpgradeCheck
=
0
8
00
;
ORGANIZATIONNAME
=
"CosmicMind, Inc."
;
ORGANIZATIONNAME
=
"CosmicMind, Inc."
;
TargetAttributes
=
{
TargetAttributes
=
{
963832351B88DFD80015F710
=
{
963832351B88DFD80015F710
=
{
...
@@ -923,6 +929,7 @@
...
@@ -923,6 +929,7 @@
96BCB7C11CB40DC500C806FE
/* Depth.swift in Sources */
,
96BCB7C11CB40DC500C806FE
/* Depth.swift in Sources */
,
96BCB7D61CB40DC500C806FE
/* Menu.swift in Sources */
,
96BCB7D61CB40DC500C806FE
/* Menu.swift in Sources */
,
96BCB7E61CB40DC500C806FE
/* TextStorage.swift in Sources */
,
96BCB7E61CB40DC500C806FE
/* TextStorage.swift in Sources */
,
968C99451D37730B000074FF
/* Direction.swift in Sources */
,
96BCB7B21CB40DC500C806FE
/* Material+UIImage+Network.swift in Sources */
,
96BCB7B21CB40DC500C806FE
/* Material+UIImage+Network.swift in Sources */
,
96BCB7A91CB40DC500C806FE
/* FlatButton.swift in Sources */
,
96BCB7A91CB40DC500C806FE
/* FlatButton.swift in Sources */
,
96BCB7CA1CB40DC500C806FE
/* Layout.swift in Sources */
,
96BCB7CA1CB40DC500C806FE
/* Layout.swift in Sources */
,
...
@@ -957,6 +964,7 @@
...
@@ -957,6 +964,7 @@
96BCB7C21CB40DC500C806FE
/* Device.swift in Sources */
,
96BCB7C21CB40DC500C806FE
/* Device.swift in Sources */
,
96BCB7A41CB40DC500C806FE
/* CaptureSession.swift in Sources */
,
96BCB7A41CB40DC500C806FE
/* CaptureSession.swift in Sources */
,
96BCB7C51CB40DC500C806FE
/* MaterialGravity.swift in Sources */
,
96BCB7C51CB40DC500C806FE
/* MaterialGravity.swift in Sources */
,
968C99471D377849000074FF
/* Offset.swift in Sources */
,
96BCB7D51CB40DC500C806FE
/* View.swift in Sources */
,
96BCB7D51CB40DC500C806FE
/* View.swift in Sources */
,
96BCB7DE1CB40DC500C806FE
/* SearchBar.swift in Sources */
,
96BCB7DE1CB40DC500C806FE
/* SearchBar.swift in Sources */
,
96BCB7B11CB40DC500C806FE
/* Material+UIImage+Crop.swift in Sources */
,
96BCB7B11CB40DC500C806FE
/* Material+UIImage+Crop.swift in Sources */
,
...
@@ -1170,6 +1178,7 @@
...
@@ -1170,6 +1178,7 @@
PRODUCT_NAME
=
Material
;
PRODUCT_NAME
=
Material
;
PROVISIONING_PROFILE
=
""
;
PROVISIONING_PROFILE
=
""
;
SKIP_INSTALL
=
YES
;
SKIP_INSTALL
=
YES
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Owholemodule"
;
};
};
name
=
Release
;
name
=
Release
;
};
};
...
@@ -1205,6 +1214,7 @@
...
@@ -1205,6 +1214,7 @@
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks @loader_path/Frameworks"
;
LD_RUNPATH_SEARCH_PATHS
=
"$(inherited) @executable_path/Frameworks @loader_path/Frameworks"
;
PRODUCT_BUNDLE_IDENTIFIER
=
"io.cosmicmind.Material-iOS-Tests"
;
PRODUCT_BUNDLE_IDENTIFIER
=
"io.cosmicmind.Material-iOS-Tests"
;
PRODUCT_NAME
=
Material
;
PRODUCT_NAME
=
Material
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Owholemodule"
;
};
};
name
=
Release
;
name
=
Release
;
};
};
...
@@ -1251,6 +1261,7 @@
...
@@ -1251,6 +1261,7 @@
PRODUCT_NAME
=
Material
;
PRODUCT_NAME
=
Material
;
SDKROOT
=
macosx
;
SDKROOT
=
macosx
;
SKIP_INSTALL
=
YES
;
SKIP_INSTALL
=
YES
;
SWIFT_OPTIMIZATION_LEVEL
=
"-Owholemodule"
;
};
};
name
=
Release
;
name
=
Release
;
};
};
...
...
Material.xcodeproj/xcshareddata/xcschemes/Material iOS.xcscheme
View file @
d2cb2d46
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
<Scheme
LastUpgradeVersion =
"0
72
0"
LastUpgradeVersion =
"0
80
0"
version =
"1.3"
>
version =
"1.3"
>
<BuildAction
<BuildAction
parallelizeBuildables =
"YES"
parallelizeBuildables =
"YES"
...
...
Sources/iOS/BottomNavigationController.swift
View file @
d2cb2d46
...
@@ -48,7 +48,7 @@ public class BottomNavigationFadeAnimatedTransitioning : NSObject, UIViewControl
...
@@ -48,7 +48,7 @@ public class BottomNavigationFadeAnimatedTransitioning : NSObject, UIViewControl
}
}
}
}
public
func
transitionDuration
(
transitionContext
:
UIViewControllerContextTransitioning
?)
->
NS
TimeInterval
{
public
func
transitionDuration
(
transitionContext
:
UIViewControllerContextTransitioning
?)
->
TimeInterval
{
return
0.35
return
0.35
}
}
}
}
...
...
Sources/iOS/BottomTabBar.swift
View file @
d2cb2d46
...
@@ -33,12 +33,12 @@ import UIKit
...
@@ -33,12 +33,12 @@ import UIKit
public
extension
UITabBarItem
{
public
extension
UITabBarItem
{
/// Sets the color of the title color for a state.
/// Sets the color of the title color for a state.
public
func
setTitleColor
(
color
:
UIColor
,
forState
state
:
UIControlState
)
{
public
func
setTitleColor
(
color
:
UIColor
,
forState
state
:
UIControlState
)
{
setTitleTextAttributes
([
NSForegroundColorAttributeName
:
color
],
for
State
:
state
)
setTitleTextAttributes
([
NSForegroundColorAttributeName
:
color
],
for
:
state
)
}
}
}
}
@IBDesignable
@IBDesignable
public
class
BottomTabBar
:
UITabBar
{
public
class
BottomTabBar
:
UITabBar
{
/// Automatically aligns the BottomNavigationBar to the superview.
/// Automatically aligns the BottomNavigationBar to the superview.
public
var
autoLayoutToSuperview
:
Bool
=
true
public
var
autoLayoutToSuperview
:
Bool
=
true
...
@@ -117,7 +117,7 @@ public class BottomTabBar : UITabBar {
...
@@ -117,7 +117,7 @@ public class BottomTabBar : UITabBar {
/// A property that accesses the backing layer's shadowColor.
/// A property that accesses the backing layer's shadowColor.
@IBInspectable
public
var
shadowColor
:
UIColor
?
{
@IBInspectable
public
var
shadowColor
:
UIColor
?
{
didSet
{
didSet
{
layer
.
shadowColor
=
shadowColor
?
.
CG
Color
layer
.
shadowColor
=
shadowColor
?
.
cg
Color
}
}
}
}
...
@@ -154,7 +154,7 @@ public class BottomTabBar : UITabBar {
...
@@ -154,7 +154,7 @@ public class BottomTabBar : UITabBar {
/// A preset property to set the borderWidth.
/// A preset property to set the borderWidth.
public
var
borderWidthPreset
:
MaterialBorder
=
.
None
{
public
var
borderWidthPreset
:
MaterialBorder
=
.
None
{
didSet
{
didSet
{
borderWidth
=
MaterialBorderToValue
(
borderWidthPreset
)
borderWidth
=
MaterialBorderToValue
(
border
:
border
WidthPreset
)
}
}
}
}
...
@@ -171,10 +171,10 @@ public class BottomTabBar : UITabBar {
...
@@ -171,10 +171,10 @@ public class BottomTabBar : UITabBar {
/// A property that accesses the layer.borderColor property.
/// A property that accesses the layer.borderColor property.
@IBInspectable
public
var
borderColor
:
UIColor
?
{
@IBInspectable
public
var
borderColor
:
UIColor
?
{
get
{
get
{
return
nil
==
layer
.
borderColor
?
nil
:
UIColor
(
CG
Color
:
layer
.
borderColor
!
)
return
nil
==
layer
.
borderColor
?
nil
:
UIColor
(
cg
Color
:
layer
.
borderColor
!
)
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
borderColor
=
value
?
.
CG
Color
layer
.
borderColor
=
value
?
.
cg
Color
}
}
}
}
...
@@ -246,10 +246,10 @@ public class BottomTabBar : UITabBar {
...
@@ -246,10 +246,10 @@ public class BottomTabBar : UITabBar {
when subclassing.
when subclassing.
*/
*/
public
func
prepareView
()
{
public
func
prepareView
()
{
depth
=
.
depth1
depth
Preset
=
.
depth1
contentScaleFactor
=
Device
.
scale
contentScaleFactor
=
Device
.
scale
backgroundColor
=
Color
.
white
backgroundColor
=
Color
.
white
let
image
:
UIImage
?
=
UIImage
.
imageWithColor
(
Color
.
clear
,
size
:
CGSizeMake
(
1
,
1
))
let
image
:
UIImage
?
=
UIImage
.
imageWithColor
(
color
:
Color
.
clear
,
size
:
CGSize
(
width
:
1
,
height
:
1
))
shadowImage
=
image
shadowImage
=
image
backgroundImage
=
image
backgroundImage
=
image
}
}
...
@@ -264,10 +264,10 @@ public class MaterialAssociatedObjectTabBar {
...
@@ -264,10 +264,10 @@ public class MaterialAssociatedObjectTabBar {
for the backing layer. This is the preferred method of setting depth
for the backing layer. This is the preferred method of setting depth
in order to maintain consitency across UI objects.
in order to maintain consitency across UI objects.
*/
*/
public
var
d
epthPreset
public
var
depthPreset
:
D
epthPreset
public
init
(
d
epthPreset
)
{
public
init
(
depthPreset
:
D
epthPreset
)
{
self
.
depth
=
depth
self
.
depth
Preset
=
depthPreset
}
}
}
}
...
@@ -276,7 +276,7 @@ public extension UITabBar {
...
@@ -276,7 +276,7 @@ public extension UITabBar {
public
internal(set)
var
item
:
MaterialAssociatedObjectTabBar
{
public
internal(set)
var
item
:
MaterialAssociatedObjectTabBar
{
get
{
get
{
return
AssociatedObject
(
base
:
self
,
key
:
&
MaterialAssociatedObjectTabBarKey
)
{
return
AssociatedObject
(
base
:
self
,
key
:
&
MaterialAssociatedObjectTabBarKey
)
{
return
MaterialAssociatedObjectTabBar
(
depth
:
.
none
)
return
MaterialAssociatedObjectTabBar
(
depth
Preset
:
.
none
)
}
}
}
}
set
(
value
)
{
set
(
value
)
{
...
@@ -289,13 +289,13 @@ public extension UITabBar {
...
@@ -289,13 +289,13 @@ public extension UITabBar {
for the backing layer. This is the preferred method of setting depth
for the backing layer. This is the preferred method of setting depth
in order to maintain consitency across UI objects.
in order to maintain consitency across UI objects.
*/
*/
public
var
d
epthPreset
{
public
var
depthPreset
:
D
epthPreset
{
get
{
get
{
return
item
.
depth
return
item
.
depth
Preset
}
}
set
(
value
)
{
set
(
value
)
{
let
v
=
DepthPresetToValue
(
preset
:
value
)
let
v
=
DepthPresetToValue
(
preset
:
value
)
layer
.
shadowOffset
=
v
.
offset
layer
.
shadowOffset
=
v
.
offset
.
asSize
layer
.
shadowOpacity
=
v
.
opacity
layer
.
shadowOpacity
=
v
.
opacity
layer
.
shadowRadius
=
v
.
radius
layer
.
shadowRadius
=
v
.
radius
}
}
...
...
Sources/iOS/Button.swift
View file @
d2cb2d46
...
@@ -209,7 +209,7 @@ public class Button: UIButton {
...
@@ -209,7 +209,7 @@ public class Button: UIButton {
*/
*/
public
var
depth
=
Depth
.
zero
{
public
var
depth
=
Depth
.
zero
{
didSet
{
didSet
{
shadowOffset
=
depth
.
offset
A
sSize
shadowOffset
=
depth
.
offset
.
a
sSize
shadowOpacity
=
depth
.
opacity
shadowOpacity
=
depth
.
opacity
shadowRadius
=
depth
.
radius
shadowRadius
=
depth
.
radius
layoutShadowPath
()
layoutShadowPath
()
...
...
Sources/iOS/Depth.swift
View file @
d2cb2d46
...
@@ -41,7 +41,7 @@ public enum DepthPreset {
...
@@ -41,7 +41,7 @@ public enum DepthPreset {
public
struct
Depth
{
public
struct
Depth
{
/// Offset.
/// Offset.
public
var
offset
:
UI
Offset
public
var
offset
:
Offset
/// Opacity.
/// Opacity.
public
var
opacity
:
Float
public
var
opacity
:
Float
...
@@ -49,18 +49,13 @@ public struct Depth {
...
@@ -49,18 +49,13 @@ public struct Depth {
/// Radius.
/// Radius.
public
var
radius
:
CGFloat
public
var
radius
:
CGFloat
/// Offset as size.
public
var
offsetAsSize
:
CGSize
{
return
CGSize
(
width
:
offset
.
horizontal
,
height
:
offset
.
vertical
)
}
/**
/**
Initializer.
Initializer.
- Parameter offset: UIOffset.
- Parameter offset: UIOffset.
- Parameter opacity: Float.
- Parameter opacity: Float.
- Parameter radius: CGFloat.
- Parameter radius: CGFloat.
*/
*/
public
init
(
offset
:
UIOffset
=
UI
Offset
.
zero
,
opacity
:
Float
=
0
,
radius
:
CGFloat
=
0
)
{
public
init
(
offset
:
Offset
=
Offset
.
zero
,
opacity
:
Float
=
0
,
radius
:
CGFloat
=
0
)
{
self
.
offset
=
offset
self
.
offset
=
offset
self
.
opacity
=
opacity
self
.
opacity
=
opacity
self
.
radius
=
radius
self
.
radius
=
radius
...
@@ -81,14 +76,14 @@ public func DepthPresetToValue(preset: DepthPreset) -> Depth {
...
@@ -81,14 +76,14 @@ public func DepthPresetToValue(preset: DepthPreset) -> Depth {
case
.
none
:
case
.
none
:
return
Depth
.
zero
return
Depth
.
zero
case
.
depth1
:
case
.
depth1
:
return
Depth
(
offset
:
UI
Offset
(
horizontal
:
0
,
vertical
:
1
),
opacity
:
0.3
,
radius
:
1
)
return
Depth
(
offset
:
Offset
(
horizontal
:
0
,
vertical
:
1
),
opacity
:
0.3
,
radius
:
1
)
case
.
depth2
:
case
.
depth2
:
return
Depth
(
offset
:
UI
Offset
(
horizontal
:
0
,
vertical
:
2
),
opacity
:
0.3
,
radius
:
2
)
return
Depth
(
offset
:
Offset
(
horizontal
:
0
,
vertical
:
2
),
opacity
:
0.3
,
radius
:
2
)
case
.
depth3
:
case
.
depth3
:
return
Depth
(
offset
:
UI
Offset
(
horizontal
:
0
,
vertical
:
3
),
opacity
:
0.3
,
radius
:
3
)
return
Depth
(
offset
:
Offset
(
horizontal
:
0
,
vertical
:
3
),
opacity
:
0.3
,
radius
:
3
)
case
.
depth4
:
case
.
depth4
:
return
Depth
(
offset
:
UI
Offset
(
horizontal
:
0
,
vertical
:
4
),
opacity
:
0.3
,
radius
:
4
)
return
Depth
(
offset
:
Offset
(
horizontal
:
0
,
vertical
:
4
),
opacity
:
0.3
,
radius
:
4
)
case
.
depth5
:
case
.
depth5
:
return
Depth
(
offset
:
UI
Offset
(
horizontal
:
0
,
vertical
:
5
),
opacity
:
0.3
,
radius
:
5
)
return
Depth
(
offset
:
Offset
(
horizontal
:
0
,
vertical
:
5
),
opacity
:
0.3
,
radius
:
5
)
}
}
}
}
Sources/iOS/Direction.swift
0 → 100644
View file @
d2cb2d46
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
public
enum
Direction
{
case
up
case
down
case
left
case
right
}
Sources/iOS/Grid.swift
View file @
d2cb2d46
...
@@ -171,7 +171,7 @@ public class Grid {
...
@@ -171,7 +171,7 @@ public class Grid {
}
}
/// An Array of UIButtons.
/// An Array of UIButtons.
public
var
views
:
Array
<
UIView
>
?
{
public
var
views
:
[
UIView
]
?
{
didSet
{
didSet
{
reload
()
reload
()
}
}
...
@@ -194,9 +194,9 @@ public class Grid {
...
@@ -194,9 +194,9 @@ public class Grid {
/// Reload the button layout.
/// Reload the button layout.
public
func
reload
()
{
public
func
reload
()
{
if
let
v
:
Array
<
UIView
>
=
views
{
if
let
v
=
views
{
let
gc
:
Int
=
axis
.
inherited
?
columns
:
axis
.
columns
let
gc
=
axis
.
inherited
?
columns
:
axis
.
columns
let
gr
:
Int
=
axis
.
inherited
?
rows
:
axis
.
rows
let
gr
=
axis
.
inherited
?
rows
:
axis
.
rows
var
n
:
Int
=
0
var
n
:
Int
=
0
for
i
in
0
..<
v
.
count
{
for
i
in
0
..<
v
.
count
{
let
child
:
UIView
=
v
[
i
]
let
child
:
UIView
=
v
[
i
]
...
...
Sources/iOS/IconButton.swift
View file @
d2cb2d46
...
@@ -41,6 +41,6 @@ public class IconButton: Button {
...
@@ -41,6 +41,6 @@ public class IconButton: Button {
public
override
func
prepareView
()
{
public
override
func
prepareView
()
{
super
.
prepareView
()
super
.
prepareView
()
cornerRadiusPreset
=
.
Radius1
cornerRadiusPreset
=
.
Radius1
pulseAnimation
=
.
C
enter
pulseAnimation
=
.
c
enter
}
}
}
}
Sources/iOS/Material+UIImage+TintColor.swift
View file @
d2cb2d46
...
@@ -36,21 +36,23 @@ public extension UIImage {
...
@@ -36,21 +36,23 @@ public extension UIImage {
- Parameter color: The UIColor to create the image from.
- Parameter color: The UIColor to create the image from.
- Returns: A UIImage that is the color passed in.
- Returns: A UIImage that is the color passed in.
*/
*/
public
func
tintWithColor
(
color
:
UIColor
)
->
UIImage
{
public
func
tintWithColor
(
color
:
UIColor
)
->
UIImage
?
{
UIGraphicsBeginImageContextWithOptions
(
size
,
false
,
Device
.
scale
)
UIGraphicsBeginImageContextWithOptions
(
size
,
false
,
Device
.
scale
)
let
context
=
UIGraphicsGetCurrentContext
()
guard
let
context
=
UIGraphicsGetCurrentContext
()
else
{
return
nil
}
CGContextScaleCTM
(
context
,
1.0
,
-
1.0
)
context
.
scale
(
x
:
1.0
,
y
:
-
1.0
)
CGContextTranslateCTM
(
context
,
0.0
,
-
size
.
height
)
context
.
translate
(
x
:
0.0
,
y
:
-
size
.
height
)
CGContextSetBlendMode
(
context
,
.
M
ultiply
)
context
.
setBlendMode
(
.
m
ultiply
)
let
rect
=
CGRectMake
(
0
,
0
,
size
.
width
,
size
.
height
)
let
rect
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
size
.
width
,
height
:
size
.
height
)
CGContextClipToMask
(
context
,
rect
,
cgImage
)
context
.
clipToMask
(
rect
,
mask
:
cgImage
!
)
color
.
setFill
()
color
.
setFill
()
CGContextFillRect
(
context
,
rect
)
context
.
fill
(
rect
)
let
image
:
UIImage
=
UIGraphicsGetImageFromCurrentImageContext
()
let
image
:
UIImage
=
UIGraphicsGetImageFromCurrentImageContext
()
!
UIGraphicsEndImageContext
()
UIGraphicsEndImageContext
()
return
image
return
image
}
}
...
...
Sources/iOS/MaterialAnimation.swift
View file @
d2cb2d46
...
@@ -65,7 +65,7 @@ public typealias MaterialAnimationDelayCancelBlock = (cancel : Bool) -> Void
...
@@ -65,7 +65,7 @@ public typealias MaterialAnimationDelayCancelBlock = (cancel : Bool) -> Void
public
struct
MaterialAnimation
{
public
struct
MaterialAnimation
{
/// Delay helper method.
/// Delay helper method.
public
static
func
delay
(
time
:
NS
TimeInterval
,
completion
:
()
->
Void
)
->
MaterialAnimationDelayCancelBlock
?
{
public
static
func
delay
(
time
:
TimeInterval
,
completion
:
()
->
Void
)
->
MaterialAnimationDelayCancelBlock
?
{
func
dispatch_later
(
completion
:
()
->
Void
)
{
func
dispatch_later
(
completion
:
()
->
Void
)
{
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
Int64
(
time
*
Double
(
NSEC_PER_SEC
))),
dispatch_get_main_queue
(),
completion
)
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
Int64
(
time
*
Double
(
NSEC_PER_SEC
))),
dispatch_get_main_queue
(),
completion
)
...
...
Sources/iOS/MaterialPulseAnimation.swift
View file @
d2cb2d46
...
@@ -31,13 +31,13 @@
...
@@ -31,13 +31,13 @@
import
UIKit
import
UIKit
public
enum
PulseAnimation
{
public
enum
PulseAnimation
{
case
N
one
case
n
one
case
C
enter
case
c
enter
case
C
enterWithBacking
case
c
enterWithBacking
case
C
enterRadialBeyondBounds
case
c
enterRadialBeyondBounds
case
B
acking
case
b
acking
case
AtP
oint
case
p
oint
case
AtP
ointWithBacking
case
p
ointWithBacking
}
}
internal
extension
MaterialAnimation
{
internal
extension
MaterialAnimation
{
...
@@ -52,47 +52,56 @@ internal extension MaterialAnimation {
...
@@ -52,47 +52,56 @@ internal extension MaterialAnimation {
- Parameter duration: Animation duration.
- Parameter duration: Animation duration.
- Parameter pulseLayers: An Array of CAShapeLayers used in the animation.
- Parameter pulseLayers: An Array of CAShapeLayers used in the animation.
*/
*/
internal
static
func
pulseExpandAnimation
(
layer
:
CALayer
,
visualLayer
:
CALayer
,
pulseColor
:
UIColor
,
pulseOpacity
:
CGFloat
,
point
:
CGPoint
,
width
:
CGFloat
,
height
:
CGFloat
,
inout
pulseLayers
:
Array
<
CAShapeLayer
>
,
pulseAnimation
:
PulseAnimation
)
{
internal
static
func
pulseExpandAnimation
(
layer
:
CALayer
,
visualLayer
:
CALayer
,
pulseColor
:
UIColor
,
pulseOpacity
:
CGFloat
,
point
:
CGPoint
,
width
:
CGFloat
,
height
:
CGFloat
,
pulseLayers
:
inout
Array
<
CAShapeLayer
>
,
pulseAnimation
:
PulseAnimation
)
{
if
.
None
!=
pulseAnimation
{
guard
.
none
!=
pulseAnimation
else
{
if
let
n
:
CGFloat
=
.
Center
==
pulseAnimation
?
width
<
height
?
width
:
height
:
width
<
height
?
height
:
width
{
return
}
let
n
=
.
center
==
pulseAnimation
?
width
<
height
?
width
:
height
:
width
<
height
?
height
:
width
let
bLayer
:
CAShapeLayer
=
CAShapeLayer
()
let
bLayer
:
CAShapeLayer
=
CAShapeLayer
()
let
pLayer
:
CAShapeLayer
=
CAShapeLayer
()
let
pLayer
:
CAShapeLayer
=
CAShapeLayer
()
bLayer
.
addSublayer
(
pLayer
)
bLayer
.
addSublayer
(
pLayer
)
pulseLayers
.
insert
(
bLayer
,
atIndex
:
0
)
pulseLayers
.
insert
(
bLayer
,
at
:
0
)
visualLayer
.
addSublayer
(
bLayer
)
visualLayer
.
addSublayer
(
bLayer
)
MaterialAnimation
.
animationDisabled
({
MaterialAnimation
.
animationDisabled
(
animations
:
{
bLayer
.
frame
=
visualLayer
.
bounds
bLayer
.
frame
=
visualLayer
.
bounds
pLayer
.
bounds
=
CGRectMake
(
0
,
0
,
n
,
n
)
pLayer
.
bounds
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
n
,
height
:
n
)
switch
pulseAnimation
{
switch
pulseAnimation
{
case
.
Center
,
.
CenterWithBacking
,
.
C
enterRadialBeyondBounds
:
case
.
center
,
.
centerWithBacking
,
.
c
enterRadialBeyondBounds
:
pLayer
.
position
=
CGPointMake
(
width
/
2
,
height
/
2
)
pLayer
.
position
=
CGPoint
(
x
:
width
/
2
,
y
:
height
/
2
)
default
:
default
:
pLayer
.
position
=
point
pLayer
.
position
=
point
}
}
pLayer
.
cornerRadius
=
n
/
2
pLayer
.
cornerRadius
=
n
/
2
pLayer
.
backgroundColor
=
pulseColor
.
colorWithAlphaComponent
(
pulseOpacity
)
.
CG
Color
pLayer
.
backgroundColor
=
pulseColor
.
withAlphaComponent
(
pulseOpacity
)
.
cg
Color
pLayer
.
transform
=
CATransform3DMakeAffineTransform
(
CGAffineTransformMakeScale
(
0
,
0
))
pLayer
.
transform
=
CATransform3DMakeAffineTransform
(
CGAffineTransform
(
scaleX
:
0
,
y
:
0
))
})
})
bLayer
.
setValue
(
false
,
forKey
:
"animated"
)
bLayer
.
setValue
(
false
,
forKey
:
"animated"
)
let
duration
:
CFTimeInterval
=
.
C
enter
==
pulseAnimation
?
0.16125
:
0.325
let
duration
:
CFTimeInterval
=
.
c
enter
==
pulseAnimation
?
0.16125
:
0.325
switch
pulseAnimation
{
switch
pulseAnimation
{
case
.
CenterWithBacking
,
.
Backing
,
.
AtP
ointWithBacking
:
case
.
centerWithBacking
,
.
backing
,
.
p
ointWithBacking
:
bLayer
.
addAnimation
(
MaterialAnimation
.
backgroundColor
(
pulseColor
.
colorW
ithAlphaComponent
(
pulseOpacity
/
2
),
duration
:
duration
),
forKey
:
nil
)
bLayer
.
add
(
MaterialAnimation
.
backgroundColor
(
color
:
pulseColor
.
w
ithAlphaComponent
(
pulseOpacity
/
2
),
duration
:
duration
),
forKey
:
nil
)
default
:
break
default
:
break
}
}
switch
pulseAnimation
{
switch
pulseAnimation
{
case
.
Center
,
.
CenterWithBacking
,
.
CenterRadialBeyondBounds
,
.
AtPoint
,
.
AtP
ointWithBacking
:
case
.
center
,
.
centerWithBacking
,
.
centerRadialBeyondBounds
,
.
point
,
.
p
ointWithBacking
:
pLayer
.
addAnimation
(
MaterialAnimation
.
scale
(
1
,
duration
:
duration
),
forKey
:
nil
)
pLayer
.
add
(
MaterialAnimation
.
scale
(
scale
:
1
,
duration
:
duration
),
forKey
:
nil
)
default
:
break
default
:
break
}
}
MaterialAnimation
.
delay
(
duration
,
completion
:
{
MaterialAnimation
.
delay
(
time
:
duration
,
completion
:
{
bLayer
.
setValue
(
true
,
forKey
:
"animated"
)
bLayer
.
setValue
(
true
,
forKey
:
"animated"
)
})
})
}
}
}
}
/**
/**
Triggers the contracting animation.
Triggers the contracting animation.
...
@@ -100,32 +109,36 @@ internal extension MaterialAnimation {
...
@@ -100,32 +109,36 @@ internal extension MaterialAnimation {
- Parameter pulseColor: The UIColor for the pulse.
- Parameter pulseColor: The UIColor for the pulse.
- Parameter pulseLayers: An Array of CAShapeLayers used in the animation.
- Parameter pulseLayers: An Array of CAShapeLayers used in the animation.
*/
*/
internal
static
func
pulseContractAnimation
(
layer
:
CALayer
,
visualLayer
:
CALayer
,
pulseColor
:
UIColor
,
inout
pulseLayers
:
Array
<
CAShapeLayer
>
,
pulseAnimation
:
PulseAnimation
)
{
internal
static
func
pulseContractAnimation
(
layer
:
CALayer
,
visualLayer
:
CALayer
,
pulseColor
:
UIColor
,
pulseLayers
:
inout
Array
<
CAShapeLayer
>
,
pulseAnimation
:
PulseAnimation
)
{
if
let
bLayer
:
CAShapeLayer
=
pulseLayers
.
popLast
()
{
guard
let
bLayer
:
CAShapeLayer
=
pulseLayers
.
popLast
()
else
{
let
animated
:
Bool
?
=
bLayer
.
valueForKey
(
"animated"
)
as?
Bool
return
MaterialAnimation
.
delay
(
true
==
animated
?
0
:
0.15
)
{
}
let
animated
:
Bool
?
=
bLayer
.
value
(
forKey
:
"animated"
)
as?
Bool
MaterialAnimation
.
delay
(
time
:
true
==
animated
?
0
:
0.15
)
{
if
let
pLayer
:
CAShapeLayer
=
bLayer
.
sublayers
?
.
first
as?
CAShapeLayer
{
if
let
pLayer
:
CAShapeLayer
=
bLayer
.
sublayers
?
.
first
as?
CAShapeLayer
{
let
duration
:
CFTimeInterval
=
0.325
let
duration
:
CFTimeInterval
=
0.325
switch
pulseAnimation
{
switch
pulseAnimation
{
case
.
CenterWithBacking
,
.
Backing
,
.
AtP
ointWithBacking
:
case
.
centerWithBacking
,
.
backing
,
.
p
ointWithBacking
:
bLayer
.
addAnimation
(
MaterialAnimation
.
backgroundColor
(
pulseColor
.
colorW
ithAlphaComponent
(
0
),
duration
:
0.325
),
forKey
:
nil
)
bLayer
.
add
(
MaterialAnimation
.
backgroundColor
(
color
:
pulseColor
.
w
ithAlphaComponent
(
0
),
duration
:
0.325
),
forKey
:
nil
)
default
:
break
default
:
break
}
}
switch
pulseAnimation
{
switch
pulseAnimation
{
case
.
Center
,
.
CenterWithBacking
,
.
CenterRadialBeyondBounds
,
.
AtPoint
,
.
AtP
ointWithBacking
:
case
.
center
,
.
centerWithBacking
,
.
centerRadialBeyondBounds
,
.
point
,
.
p
ointWithBacking
:
pLayer
.
addAnimation
(
MaterialAnimation
.
animationGroup
(
[
pLayer
.
addAnimation
(
MaterialAnimation
.
animationGroup
(
animations
:
[
MaterialAnimation
.
scale
(
.
Center
==
pulseAnimation
?
1
:
1.325
),
MaterialAnimation
.
scale
(
scale
:
.
Center
==
pulseAnimation
?
1
:
1.325
),
MaterialAnimation
.
backgroundColor
(
pulseColor
.
colorWithAlphaComponent
(
0
))
MaterialAnimation
.
backgroundColor
(
pulseColor
.
colorWithAlphaComponent
(
0
))
],
duration
:
duration
),
forKey
:
nil
)
],
duration
:
duration
),
forKey
:
nil
)
default
:
break
default
:
break
}
}
MaterialAnimation
.
delay
(
duration
)
{
MaterialAnimation
.
delay
(
time
:
duration
,
completion
:
{
pLayer
.
removeFromSuperlayer
()
pLayer
.
removeFromSuperlayer
()
bLayer
.
removeFromSuperlayer
()
bLayer
.
removeFromSuperlayer
()
}
})
}
}
}
}
}
}
}
...
...
Sources/iOS/Menu.swift
View file @
d2cb2d46
This diff is collapsed.
Click to expand it.
Sources/iOS/NavigationDrawerController.swift
View file @
d2cb2d46
...
@@ -438,7 +438,7 @@ public class NavigationDrawerController : RootController, UIGestureRecognizerDel
...
@@ -438,7 +438,7 @@ public class NavigationDrawerController : RootController, UIGestureRecognizerDel
- Parameter animated: A Boolean value that indicates to animate
- Parameter animated: A Boolean value that indicates to animate
the leftView width change.
the leftView width change.
*/
*/
public
func
setLeftViewWidth
(
width
:
CGFloat
,
hidden
:
Bool
,
animated
:
Bool
,
duration
:
NS
TimeInterval
=
0.5
)
{
public
func
setLeftViewWidth
(
width
:
CGFloat
,
hidden
:
Bool
,
animated
:
Bool
,
duration
:
TimeInterval
=
0.5
)
{
if
let
v
:
View
=
leftView
{
if
let
v
:
View
=
leftView
{
leftViewWidth
=
width
leftViewWidth
=
width
...
@@ -512,7 +512,7 @@ public class NavigationDrawerController : RootController, UIGestureRecognizerDel
...
@@ -512,7 +512,7 @@ public class NavigationDrawerController : RootController, UIGestureRecognizerDel
- Parameter animated: A Boolean value that indicates to animate
- Parameter animated: A Boolean value that indicates to animate
the rightView width change.
the rightView width change.
*/
*/
public
func
setRightViewWidth
(
width
:
CGFloat
,
hidden
:
Bool
,
animated
:
Bool
,
duration
:
NS
TimeInterval
=
0.5
)
{
public
func
setRightViewWidth
(
width
:
CGFloat
,
hidden
:
Bool
,
animated
:
Bool
,
duration
:
TimeInterval
=
0.5
)
{
if
let
v
:
View
=
rightView
{
if
let
v
:
View
=
rightView
{
rightViewWidth
=
width
rightViewWidth
=
width
...
...
Sources/iOS/Offset.swift
0 → 100644
View file @
d2cb2d46
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import
UIKit
public
typealias
Offset
=
UIOffset
public
extension
Offset
{
public
var
asSize
:
CGSize
{
return
CGSize
(
width
:
horizontal
,
height
:
vertical
)
}
}
Sources/iOS/RootController.swift
View file @
d2cb2d46
...
@@ -101,7 +101,7 @@ public class RootController : UIViewController {
...
@@ -101,7 +101,7 @@ public class RootController : UIViewController {
A method to swap rootViewController objects.
A method to swap rootViewController objects.
- Parameter toViewController: The UIViewController to swap
- Parameter toViewController: The UIViewController to swap
with the active rootViewController.
with the active rootViewController.
- Parameter duration: A
NS
TimeInterval that sets the
- Parameter duration: A TimeInterval that sets the
animation duration of the transition.
animation duration of the transition.
- Parameter options: UIViewAnimationOptions thst are used
- Parameter options: UIViewAnimationOptions thst are used
when animating the transition from the active rootViewController
when animating the transition from the active rootViewController
...
@@ -113,7 +113,7 @@ public class RootController : UIViewController {
...
@@ -113,7 +113,7 @@ public class RootController : UIViewController {
the transition animation from the active rootViewController
the transition animation from the active rootViewController
to the toViewController has completed.
to the toViewController has completed.
*/
*/
public
func
transitionFromRootViewController
(
toViewController
:
UIViewController
,
duration
:
NS
TimeInterval
=
0.5
,
options
:
UIViewAnimationOptions
=
[],
animations
:
(()
->
Void
)?
=
nil
,
completion
:
((
Bool
)
->
Void
)?
=
nil
)
{
public
func
transitionFromRootViewController
(
toViewController
:
UIViewController
,
duration
:
TimeInterval
=
0.5
,
options
:
UIViewAnimationOptions
=
[],
animations
:
(()
->
Void
)?
=
nil
,
completion
:
((
Bool
)
->
Void
)?
=
nil
)
{
rootViewController
.
willMoveToParentViewController
(
nil
)
rootViewController
.
willMoveToParentViewController
(
nil
)
addChildViewController
(
toViewController
)
addChildViewController
(
toViewController
)
toViewController
.
view
.
frame
=
rootViewController
.
view
.
frame
toViewController
.
view
.
frame
=
rootViewController
.
view
.
frame
...
...
Sources/iOS/TabBar.swift
View file @
d2cb2d46
...
@@ -82,7 +82,7 @@ public class TabBar : View {
...
@@ -82,7 +82,7 @@ public class TabBar : View {
b
.
removeTarget
(
self
,
action
:
#selector(
handleButton(_:)
)
,
forControlEvents
:
.
TouchUpInside
)
b
.
removeTarget
(
self
,
action
:
#selector(
handleButton(_:)
)
,
forControlEvents
:
.
TouchUpInside
)
b
.
addTarget
(
self
,
action
:
#selector(
handleButton(_:)
)
,
forControlEvents
:
.
TouchUpInside
)
b
.
addTarget
(
self
,
action
:
#selector(
handleButton(_:)
)
,
forControlEvents
:
.
TouchUpInside
)
}
}
grid
.
views
=
v
as
Array
<
UIView
>
grid
.
views
=
v
as
[
UIView
]
line
.
frame
=
CGRectMake
(
0
,
.
Bottom
==
lineAlignment
?
height
-
3
:
0
,
v
.
first
!.
frame
.
width
,
3
)
line
.
frame
=
CGRectMake
(
0
,
.
Bottom
==
lineAlignment
?
height
-
3
:
0
,
v
.
first
!.
frame
.
width
,
3
)
}
}
}
}
...
...
Sources/iOS/View.swift
View file @
d2cb2d46
...
@@ -261,7 +261,7 @@ public class View: UIView {
...
@@ -261,7 +261,7 @@ public class View: UIView {
*/
*/
public
var
depth
=
Depth
.
zero
{
public
var
depth
=
Depth
.
zero
{
didSet
{
didSet
{
shadowOffset
=
depth
.
offset
A
sSize
shadowOffset
=
depth
.
offset
.
a
sSize
shadowOpacity
=
depth
.
opacity
shadowOpacity
=
depth
.
opacity
shadowRadius
=
depth
.
radius
shadowRadius
=
depth
.
radius
layoutShadowPath
()
layoutShadowPath
()
...
...
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