Commit aae8ca3f by Daniel Dahan

added BasicCardView

parent ef382688
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
65BDD16E1BB899F2006F7F2B /* MaterialPulseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD16D1BB899F2006F7F2B /* MaterialPulseView.swift */; settings = {ASSET_TAGS = (); }; }; 65BDD16E1BB899F2006F7F2B /* MaterialPulseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD16D1BB899F2006F7F2B /* MaterialPulseView.swift */; settings = {ASSET_TAGS = (); }; };
65BDD1721BB8CD77006F7F2B /* MaterialLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1711BB8CD77006F7F2B /* MaterialLabel.swift */; settings = {ASSET_TAGS = (); }; }; 65BDD1721BB8CD77006F7F2B /* MaterialLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1711BB8CD77006F7F2B /* MaterialLabel.swift */; settings = {ASSET_TAGS = (); }; };
65BDD1741BB8D443006F7F2B /* MaterialAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1731BB8D443006F7F2B /* MaterialAnimation.swift */; settings = {ASSET_TAGS = (); }; }; 65BDD1741BB8D443006F7F2B /* MaterialAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1731BB8D443006F7F2B /* MaterialAnimation.swift */; settings = {ASSET_TAGS = (); }; };
65BDD1771BB98E31006F7F2B /* MaterialSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1761BB98E31006F7F2B /* MaterialSize.swift */; settings = {ASSET_TAGS = (); }; };
65BDD1791BB99C0F006F7F2B /* RaisedButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1781BB99C0F006F7F2B /* RaisedButton.swift */; settings = {ASSET_TAGS = (); }; }; 65BDD1791BB99C0F006F7F2B /* RaisedButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD1781BB99C0F006F7F2B /* RaisedButton.swift */; settings = {ASSET_TAGS = (); }; };
65BDD17C1BB99E29006F7F2B /* FabButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD17B1BB99E29006F7F2B /* FabButton.swift */; settings = {ASSET_TAGS = (); }; }; 65BDD17C1BB99E29006F7F2B /* FabButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65BDD17B1BB99E29006F7F2B /* FabButton.swift */; settings = {ASSET_TAGS = (); }; };
65DBE4201B9A9244000C804F /* Roboto-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 65DBE41E1B9A9244000C804F /* Roboto-Bold.ttf */; }; 65DBE4201B9A9244000C804F /* Roboto-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 65DBE41E1B9A9244000C804F /* Roboto-Bold.ttf */; };
...@@ -45,13 +44,10 @@ ...@@ -45,13 +44,10 @@
9638325A1B88E31A0015F710 /* MaterialKitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 963832581B88E31A0015F710 /* MaterialKitTests.swift */; }; 9638325A1B88E31A0015F710 /* MaterialKitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 963832581B88E31A0015F710 /* MaterialKitTests.swift */; };
964B17B41BBA447F002A9CA0 /* MaterialLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 964B17B31BBA447F002A9CA0 /* MaterialLayout.swift */; settings = {ASSET_TAGS = (); }; }; 964B17B41BBA447F002A9CA0 /* MaterialLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 964B17B31BBA447F002A9CA0 /* MaterialLayout.swift */; settings = {ASSET_TAGS = (); }; };
964B17B61BBA4BEA002A9CA0 /* MaterialStatusBarStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 964B17B51BBA4BEA002A9CA0 /* MaterialStatusBarStyle.swift */; settings = {ASSET_TAGS = (); }; }; 964B17B61BBA4BEA002A9CA0 /* MaterialStatusBarStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 964B17B51BBA4BEA002A9CA0 /* MaterialStatusBarStyle.swift */; settings = {ASSET_TAGS = (); }; };
964B17CB1BBB30B0002A9CA0 /* SideNavigationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 964B17CA1BBB30B0002A9CA0 /* SideNavigationView.swift */; settings = {ASSET_TAGS = (); }; };
964B17CC1BBB31C2002A9CA0 /* MaterialBorder.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD1691BB7146B006F7F2B /* MaterialBorder.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 964B17CC1BBB31C2002A9CA0 /* MaterialBorder.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD1691BB7146B006F7F2B /* MaterialBorder.swift */; settings = {ATTRIBUTES = (Public, ); }; };
964B17CD1BBB31C2002A9CA0 /* MaterialShape.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD16B1BB88D1A006F7F2B /* MaterialShape.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 964B17CD1BBB31C2002A9CA0 /* MaterialShape.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD16B1BB88D1A006F7F2B /* MaterialShape.swift */; settings = {ATTRIBUTES = (Public, ); }; };
964B17CE1BBB31C2002A9CA0 /* MaterialSize.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD1761BB98E31006F7F2B /* MaterialSize.swift */; settings = {ATTRIBUTES = (Public, ); }; };
964B17CF1BBB31C2002A9CA0 /* MaterialStatusBarStyle.swift in Headers */ = {isa = PBXBuildFile; fileRef = 964B17B51BBA4BEA002A9CA0 /* MaterialStatusBarStyle.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 964B17CF1BBB31C2002A9CA0 /* MaterialStatusBarStyle.swift in Headers */ = {isa = PBXBuildFile; fileRef = 964B17B51BBA4BEA002A9CA0 /* MaterialStatusBarStyle.swift */; settings = {ATTRIBUTES = (Public, ); }; };
964B17D01BBB31C2002A9CA0 /* MaterialPulseView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD16D1BB899F2006F7F2B /* MaterialPulseView.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 964B17D01BBB31C2002A9CA0 /* MaterialPulseView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD16D1BB899F2006F7F2B /* MaterialPulseView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
964B17D11BBB31C2002A9CA0 /* SideNavigationView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 964B17CA1BBB30B0002A9CA0 /* SideNavigationView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
964B17D21BBB31C2002A9CA0 /* MaterialLabel.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD1711BB8CD77006F7F2B /* MaterialLabel.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 964B17D21BBB31C2002A9CA0 /* MaterialLabel.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD1711BB8CD77006F7F2B /* MaterialLabel.swift */; settings = {ATTRIBUTES = (Public, ); }; };
964B17D31BBB31C2002A9CA0 /* RaisedButton.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD1781BB99C0F006F7F2B /* RaisedButton.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 964B17D31BBB31C2002A9CA0 /* RaisedButton.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD1781BB99C0F006F7F2B /* RaisedButton.swift */; settings = {ATTRIBUTES = (Public, ); }; };
964B17D41BBB31C2002A9CA0 /* FabButton.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD17B1BB99E29006F7F2B /* FabButton.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 964B17D41BBB31C2002A9CA0 /* FabButton.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65BDD17B1BB99E29006F7F2B /* FabButton.swift */; settings = {ATTRIBUTES = (Public, ); }; };
...@@ -91,7 +87,6 @@ ...@@ -91,7 +87,6 @@
65BDD16D1BB899F2006F7F2B /* MaterialPulseView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialPulseView.swift; sourceTree = "<group>"; }; 65BDD16D1BB899F2006F7F2B /* MaterialPulseView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialPulseView.swift; sourceTree = "<group>"; };
65BDD1711BB8CD77006F7F2B /* MaterialLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialLabel.swift; sourceTree = "<group>"; }; 65BDD1711BB8CD77006F7F2B /* MaterialLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialLabel.swift; sourceTree = "<group>"; };
65BDD1731BB8D443006F7F2B /* MaterialAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialAnimation.swift; sourceTree = "<group>"; }; 65BDD1731BB8D443006F7F2B /* MaterialAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialAnimation.swift; sourceTree = "<group>"; };
65BDD1761BB98E31006F7F2B /* MaterialSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialSize.swift; sourceTree = "<group>"; };
65BDD1781BB99C0F006F7F2B /* RaisedButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RaisedButton.swift; sourceTree = "<group>"; }; 65BDD1781BB99C0F006F7F2B /* RaisedButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RaisedButton.swift; sourceTree = "<group>"; };
65BDD17B1BB99E29006F7F2B /* FabButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FabButton.swift; sourceTree = "<group>"; }; 65BDD17B1BB99E29006F7F2B /* FabButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FabButton.swift; sourceTree = "<group>"; };
65DBE41E1B9A9244000C804F /* Roboto-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Bold.ttf"; sourceTree = "<group>"; }; 65DBE41E1B9A9244000C804F /* Roboto-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Bold.ttf"; sourceTree = "<group>"; };
...@@ -105,7 +100,6 @@ ...@@ -105,7 +100,6 @@
963832631B88E5BF0015F710 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; }; 963832631B88E5BF0015F710 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
964B17B31BBA447F002A9CA0 /* MaterialLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialLayout.swift; sourceTree = "<group>"; }; 964B17B31BBA447F002A9CA0 /* MaterialLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialLayout.swift; sourceTree = "<group>"; };
964B17B51BBA4BEA002A9CA0 /* MaterialStatusBarStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialStatusBarStyle.swift; sourceTree = "<group>"; }; 964B17B51BBA4BEA002A9CA0 /* MaterialStatusBarStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialStatusBarStyle.swift; sourceTree = "<group>"; };
964B17CA1BBB30B0002A9CA0 /* SideNavigationView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SideNavigationView.swift; sourceTree = "<group>"; };
964B17D81BBB3911002A9CA0 /* BasicCardView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicCardView.swift; sourceTree = "<group>"; }; 964B17D81BBB3911002A9CA0 /* BasicCardView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicCardView.swift; sourceTree = "<group>"; };
9AAC38551B8956C500FE6B2D /* Roboto-Light.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Light.ttf"; sourceTree = "<group>"; }; 9AAC38551B8956C500FE6B2D /* Roboto-Light.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Light.ttf"; sourceTree = "<group>"; };
9AAC38571B8956CF00FE6B2D /* Roboto-Medium.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Medium.ttf"; sourceTree = "<group>"; }; 9AAC38571B8956CF00FE6B2D /* Roboto-Medium.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Medium.ttf"; sourceTree = "<group>"; };
...@@ -168,7 +162,6 @@ ...@@ -168,7 +162,6 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
962F3E521BACA68C0004B8AD /* NavigationBarView.swift */, 962F3E521BACA68C0004B8AD /* NavigationBarView.swift */,
964B17CA1BBB30B0002A9CA0 /* SideNavigationView.swift */,
); );
name = Navigation; name = Navigation;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -277,7 +270,6 @@ ...@@ -277,7 +270,6 @@
65BDD15C1BB70D60006F7F2B /* MaterialInsets.swift */, 65BDD15C1BB70D60006F7F2B /* MaterialInsets.swift */,
65BDD1691BB7146B006F7F2B /* MaterialBorder.swift */, 65BDD1691BB7146B006F7F2B /* MaterialBorder.swift */,
65BDD16B1BB88D1A006F7F2B /* MaterialShape.swift */, 65BDD16B1BB88D1A006F7F2B /* MaterialShape.swift */,
65BDD1761BB98E31006F7F2B /* MaterialSize.swift */,
964B17B51BBA4BEA002A9CA0 /* MaterialStatusBarStyle.swift */, 964B17B51BBA4BEA002A9CA0 /* MaterialStatusBarStyle.swift */,
); );
name = Theme; name = Theme;
...@@ -313,10 +305,8 @@ ...@@ -313,10 +305,8 @@
65BDD1681BB7111E006F7F2B /* FlatButton.swift in Headers */, 65BDD1681BB7111E006F7F2B /* FlatButton.swift in Headers */,
964B17CC1BBB31C2002A9CA0 /* MaterialBorder.swift in Headers */, 964B17CC1BBB31C2002A9CA0 /* MaterialBorder.swift in Headers */,
964B17CD1BBB31C2002A9CA0 /* MaterialShape.swift in Headers */, 964B17CD1BBB31C2002A9CA0 /* MaterialShape.swift in Headers */,
964B17CE1BBB31C2002A9CA0 /* MaterialSize.swift in Headers */,
964B17CF1BBB31C2002A9CA0 /* MaterialStatusBarStyle.swift in Headers */, 964B17CF1BBB31C2002A9CA0 /* MaterialStatusBarStyle.swift in Headers */,
964B17D01BBB31C2002A9CA0 /* MaterialPulseView.swift in Headers */, 964B17D01BBB31C2002A9CA0 /* MaterialPulseView.swift in Headers */,
964B17D11BBB31C2002A9CA0 /* SideNavigationView.swift in Headers */,
964B17D21BBB31C2002A9CA0 /* MaterialLabel.swift in Headers */, 964B17D21BBB31C2002A9CA0 /* MaterialLabel.swift in Headers */,
964B17D31BBB31C2002A9CA0 /* RaisedButton.swift in Headers */, 964B17D31BBB31C2002A9CA0 /* RaisedButton.swift in Headers */,
964B17D41BBB31C2002A9CA0 /* FabButton.swift in Headers */, 964B17D41BBB31C2002A9CA0 /* FabButton.swift in Headers */,
...@@ -430,7 +420,6 @@ ...@@ -430,7 +420,6 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
65BDD15D1BB70D60006F7F2B /* MaterialInsets.swift in Sources */, 65BDD15D1BB70D60006F7F2B /* MaterialInsets.swift in Sources */,
964B17CB1BBB30B0002A9CA0 /* SideNavigationView.swift in Sources */,
65BDD1471BB5B916006F7F2B /* MaterialView.swift in Sources */, 65BDD1471BB5B916006F7F2B /* MaterialView.swift in Sources */,
65BDD16C1BB88D1A006F7F2B /* MaterialShape.swift in Sources */, 65BDD16C1BB88D1A006F7F2B /* MaterialShape.swift in Sources */,
65BDD1521BB6EE7C006F7F2B /* RobotoFont.swift in Sources */, 65BDD1521BB6EE7C006F7F2B /* RobotoFont.swift in Sources */,
...@@ -440,7 +429,6 @@ ...@@ -440,7 +429,6 @@
964B17B41BBA447F002A9CA0 /* MaterialLayout.swift in Sources */, 964B17B41BBA447F002A9CA0 /* MaterialLayout.swift in Sources */,
962F3E531BACA68C0004B8AD /* NavigationBarView.swift in Sources */, 962F3E531BACA68C0004B8AD /* NavigationBarView.swift in Sources */,
65BDD14F1BB5EE4A006F7F2B /* MaterialGravity.swift in Sources */, 65BDD14F1BB5EE4A006F7F2B /* MaterialGravity.swift in Sources */,
65BDD1771BB98E31006F7F2B /* MaterialSize.swift in Sources */,
65BDD1541BB6F473006F7F2B /* MaterialDepth.swift in Sources */, 65BDD1541BB6F473006F7F2B /* MaterialDepth.swift in Sources */,
65BDD1571BB6FC82006F7F2B /* MaterialButton.swift in Sources */, 65BDD1571BB6FC82006F7F2B /* MaterialButton.swift in Sources */,
65BDD17C1BB99E29006F7F2B /* FabButton.swift in Sources */, 65BDD17C1BB99E29006F7F2B /* FabButton.swift in Sources */,
......
...@@ -11,11 +11,14 @@ To get started, let's introduce MaterialView, a lightweight UIView Object that h ...@@ -11,11 +11,14 @@ To get started, let's introduce MaterialView, a lightweight UIView Object that h
![MaterialKitPreview](http://www.materialkit.io/github/img1.png) ![MaterialKitPreview](http://www.materialkit.io/github/img1.png)
```swift ```swift
let v: MaterialView = MaterialView(frame: CGRectMake(0, 0, 200, 200)) let v: MaterialView = MaterialView(frame: CGRectMake(100, 100, 200, 200))
v.shape = .Circle v.shape = .Circle
v.shadowDepth = .Depth2 v.shadowDepth = .Depth2
v.borderWidth = .Border1 v.borderWidth = .Border1
v.image = UIImage(named: "focus") v.image = UIImage(named: "focus")
// Add to UIViewController
view.addSubview(v)
``` ```
### Animated MaterialPulseView ### Animated MaterialPulseView
...@@ -25,11 +28,14 @@ Let's expand on the basic MaterialView and use an animated MaterialPulseView. In ...@@ -25,11 +28,14 @@ Let's expand on the basic MaterialView and use an animated MaterialPulseView. In
![MaterialKitPreview](http://www.materialkit.io/github/img2.gif) ![MaterialKitPreview](http://www.materialkit.io/github/img2.gif)
```swift ```swift
let v: MaterialPulseView = MaterialPulseView(frame: CGRectMake(0, 0, 200, 200)) let v: MaterialPulseView = MaterialPulseView(frame: CGRectMake(100, 100, 200, 200))
v.shape = .Square v.shape = .Square
v.cornerRadius = .Radius2 v.cornerRadius = .Radius2
v.shadowDepth = .Depth2 v.shadowDepth = .Depth2
v.image = UIImage(named: "focus") v.image = UIImage(named: "focus")
// Add to UIViewController
view.addSubview(v)
``` ```
### Simple FlatButton ### Simple FlatButton
...@@ -39,9 +45,12 @@ A FlatButton is the best place to start when introducing MaterialKit buttons. It ...@@ -39,9 +45,12 @@ A FlatButton is the best place to start when introducing MaterialKit buttons. It
![MaterialKitPreview](http://www.materialkit.io/github/img3.gif) ![MaterialKitPreview](http://www.materialkit.io/github/img3.gif)
```swift ```swift
let v: FlatButton = FlatButton(frame: CGRectMake(0, 0, 200, 64)) let v: FlatButton = FlatButton(frame: CGRectMake(100, 100, 200, 64))
v.setTitle("Flat", forState: .Normal) v.setTitle("Flat", forState: .Normal)
v.titleLabel!.font = RobotoFont.mediumWithSize(32) v.titleLabel!.font = RobotoFont.mediumWithSize(32)
// Add to UIViewController
view.addSubview(v)
``` ```
### Noticeable RaisedButton ### Noticeable RaisedButton
...@@ -51,9 +60,12 @@ A RaisedButton is sure to get attention. Take a look at the following code sampl ...@@ -51,9 +60,12 @@ A RaisedButton is sure to get attention. Take a look at the following code sampl
![MaterialKitPreview](http://www.materialkit.io/github/img4.gif) ![MaterialKitPreview](http://www.materialkit.io/github/img4.gif)
```swift ```swift
let v: RaisedButton = RaisedButton(frame: CGRectMake(0, 0, 200, 64)) let v: RaisedButton = RaisedButton(frame: CGRectMake(100, 100, 200, 64))
v.setTitle("Raised", forState: .Normal) v.setTitle("Raised", forState: .Normal)
v.titleLabel!.font = RobotoFont.mediumWithSize(32) v.titleLabel!.font = RobotoFont.mediumWithSize(32)
// Add to UIViewController
view.addSubview(v)
``` ```
### Actionable FabButton ### Actionable FabButton
...@@ -63,14 +75,17 @@ A FabButton is essential to Material Design's overall look. I leave this example ...@@ -63,14 +75,17 @@ A FabButton is essential to Material Design's overall look. I leave this example
![MaterialKitPreview](http://www.materialkit.io/github/img5.gif) ![MaterialKitPreview](http://www.materialkit.io/github/img5.gif)
```swift ```swift
let v: FabButton = FabButton(frame: CGRectMake(0, 0, 64, 64)) let v: FabButton = FabButton(frame: CGRectMake(100, 100, 64, 64))
v.setImage(UIImage(named: "ic_create_white"), forState: .Normal) v.setImage(UIImage(named: "ic_create_white"), forState: .Normal)
v.setImage(UIImage(named: "ic_create_white"), forState: .Highlighted) v.setImage(UIImage(named: "ic_create_white"), forState: .Highlighted)
// Add to UIViewController
view.addSubview(v)
``` ```
### Sleek NavigationBarView ### Sleek NavigationBarView
A NavigationBarView is a very common UI element and the more presentable it is, the better. The following example shows how to setup a NavigationBarView on the fly. A NavigationBarView is a very common UI element and the more presentable it is, the better. The following example shows how to setup a NavigationBarView on the fly.
![MaterialKitPreview](http://www.materialkit.io/github/img6.gif) ![MaterialKitPreview](http://www.materialkit.io/github/img6.gif)
...@@ -79,6 +94,7 @@ let v: NavigationBarView = NavigationBarView(titleLabel: MaterialLabel())! ...@@ -79,6 +94,7 @@ let v: NavigationBarView = NavigationBarView(titleLabel: MaterialLabel())!
v.titleLabel!.text = "Title" v.titleLabel!.text = "Title"
v.titleLabel!.textAlignment = .Center v.titleLabel!.textAlignment = .Center
v.titleLabel!.textColor = MaterialColor.white v.titleLabel!.textColor = MaterialColor.white
v.titleLabel!.font = RobotoFont.regularWithSize(20)
let b1: FlatButton = FlatButton() let b1: FlatButton = FlatButton()
b1.setTitle("B1", forState: .Normal) b1.setTitle("B1", forState: .Normal)
...@@ -103,6 +119,57 @@ b4.setTitleColor(MaterialColor.white, forState: .Normal) ...@@ -103,6 +119,57 @@ b4.setTitleColor(MaterialColor.white, forState: .Normal)
b4.pulseColor = MaterialColor.white b4.pulseColor = MaterialColor.white
v.rightButtons = [b3, b4] v.rightButtons = [b3, b4]
// Add to UIViewController
view.addSubview(v)
```
### Flexible BasicCardView
A BasicCardView is super flexible with all its options - including a title, detail, left buttons, and right buttons. Below is an example of a simple setup.
![MaterialKitPreview](http://www.materialkit.io/github/img7.gif)
```swift
let v: BasicCardView = BasicCardView(titleLabel: UILabel(), detailLabel: UILabel())!
v.titleLabel!.text = "Card Title"
v.detailLabel!.text = "I am a very simple card. I am good at containing small bits of information. I am convenient because I require little code to use effectively."
let b1: FlatButton = FlatButton()
b1.setTitle("Button 1", forState: .Normal)
let b2: FlatButton = FlatButton()
b2.setTitle("Button 2", forState: .Normal)
v.leftButtons = [b1, b2]
// Add to UIViewController
view.addSubview(v)
v.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignToParentHorizontallyWithInsets(view, child: v, left: 20, right: 20)
MaterialLayout.alignFromTop(view, child: v, top: 100)
```
A BasicCardView can easily add an image as its background, below is the code that shows how to do this.
![MaterialKitPreview](http://www.materialkit.io/github/img8.gif)
```swift
let v: BasicCardView = BasicCardView(titleLabel: UILabel(), detailLabel: UILabel())!
v.image = UIImage(named: "forest")
v.titleLabel!.text = "Card Title"
v.detailLabel!.text = "I am a very simple card. I am good at containing small bits of information. I am convenient because I require little code to use effectively."
// Add to UIViewController
view.addSubview(v)
v.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignToParentHorizontallyWithInsets(view, child: v, left: 20, right: 20)
MaterialLayout.alignFromTop(view, child: v, top: 100)
``` ```
### License ### License
......
...@@ -19,6 +19,30 @@ ...@@ -19,6 +19,30 @@
import UIKit import UIKit
public class BasicCardView: MaterialPulseView { public class BasicCardView: MaterialPulseView {
//
// :name: dividerLayer
//
internal var dividerLayer: CAShapeLayer?
//
// :name: dividerColor
//
public var dividerColor: UIColor? {
didSet {
dividerLayer?.backgroundColor = dividerColor?.CGColor
reloadView()
}
}
/**
:name: divider
*/
public var divider: Bool = MaterialTheme.basicCardView.divider {
didSet {
reloadView()
}
}
/** /**
:name: contentInsets :name: contentInsets
*/ */
...@@ -135,6 +159,9 @@ public class BasicCardView: MaterialPulseView { ...@@ -135,6 +159,9 @@ public class BasicCardView: MaterialPulseView {
if let v = leftButtons { if let v = leftButtons {
for b in v { for b in v {
b.translatesAutoresizingMaskIntoConstraints = false b.translatesAutoresizingMaskIntoConstraints = false
b.setTitleColor(MaterialColor.amber.darken1, forState: .Normal)
b.setTitleColor(MaterialColor.amber.lighten1, forState: .Highlighted)
b.pulseColor = nil
} }
} }
reloadView() reloadView()
...@@ -168,6 +195,9 @@ public class BasicCardView: MaterialPulseView { ...@@ -168,6 +195,9 @@ public class BasicCardView: MaterialPulseView {
if let v = rightButtons { if let v = rightButtons {
for b in v { for b in v {
b.translatesAutoresizingMaskIntoConstraints = false b.translatesAutoresizingMaskIntoConstraints = false
b.setTitleColor(MaterialColor.amber.darken1, forState: .Normal)
b.setTitleColor(MaterialColor.amber.lighten1, forState: .Highlighted)
b.pulseColor = nil
} }
} }
reloadView() reloadView()
...@@ -204,6 +234,28 @@ public class BasicCardView: MaterialPulseView { ...@@ -204,6 +234,28 @@ public class BasicCardView: MaterialPulseView {
} }
/** /**
:name: layoutSubviews
*/
public override func layoutSubviews() {
super.layoutSubviews()
// divider
if true == divider {
var y: CGFloat = 0
if 0 < leftButtons?.count {
y += contentInsetsRef!.bottom + leftButtonsInsetsRef!.top + leftButtonsInsetsRef!.bottom + leftButtons![0].height
} else if 0 < rightButtons?.count {
y += contentInsetsRef!.bottom + rightButtonsInsetsRef!.top + rightButtonsInsetsRef!.bottom + rightButtons![0].height
}
if 0 < y {
prepareDivider(bounds.size.height - y - 0.5, width: bounds.size.width)
}
} else {
dividerLayer?.removeFromSuperlayer()
dividerLayer = nil
}
}
/**
:name: reloadView :name: reloadView
*/ */
public func reloadView() { public func reloadView() {
...@@ -213,17 +265,23 @@ public class BasicCardView: MaterialPulseView { ...@@ -213,17 +265,23 @@ public class BasicCardView: MaterialPulseView {
v.removeFromSuperview() v.removeFromSuperview()
} }
var verticalFormat: String = "V:|-(insetTop)" var verticalFormat: String = "V:|"
var views: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>() var views: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
var metrics: Dictionary<String, AnyObject> = ["insetTop": contentInsetsRef!.top, "insetBottom": contentInsetsRef!.bottom] var metrics: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
if nil != titleLabel {
verticalFormat += "-(insetTop)"
metrics["insetTop"] = contentInsetsRef!.top + titleLabelInsetsRef!.top
} else if nil != detailLabel {
verticalFormat += "-(insetTop)"
metrics["insetTop"] = contentInsetsRef!.top + detailLabelInsetsRef!.top
}
// title // title
if let v = titleLabel { if let v = titleLabel {
verticalFormat += "-[titleLabel]" verticalFormat += "-[titleLabel]"
views["titleLabel"] = v views["titleLabel"] = v
metrics["insetTop"] = titleLabelInsetsRef!.top
addSubview(v) addSubview(v)
v.layer.zPosition = 2000 v.layer.zPosition = 2000
MaterialLayout.alignToParentHorizontallyWithInsets(self, child: v, left: contentInsetsRef!.left + titleLabelInsetsRef!.left, right: contentInsetsRef!.right + titleLabelInsetsRef!.right) MaterialLayout.alignToParentHorizontallyWithInsets(self, child: v, left: contentInsetsRef!.left + titleLabelInsetsRef!.left, right: contentInsetsRef!.right + titleLabelInsetsRef!.right)
...@@ -231,9 +289,7 @@ public class BasicCardView: MaterialPulseView { ...@@ -231,9 +289,7 @@ public class BasicCardView: MaterialPulseView {
// detail // detail
if let v = detailLabel { if let v = detailLabel {
if nil == titleLabel { if nil != titleLabel {
metrics["insetTop"] = detailLabelInsetsRef!.top
} else {
verticalFormat += "-(insetB)" verticalFormat += "-(insetB)"
metrics["insetB"] = titleLabelInsetsRef!.bottom + detailLabelInsetsRef!.top metrics["insetB"] = titleLabelInsetsRef!.bottom + detailLabelInsetsRef!.top
} }
...@@ -260,7 +316,7 @@ public class BasicCardView: MaterialPulseView { ...@@ -260,7 +316,7 @@ public class BasicCardView: MaterialPulseView {
addSubview(b) addSubview(b)
b.layer.zPosition = 2000 b.layer.zPosition = 2000
MaterialLayout.alignFromBottom(self, child: b, bottom: leftButtonsInsetsRef!.bottom) MaterialLayout.alignFromBottom(self, child: b, bottom: contentInsetsRef!.bottom + leftButtonsInsetsRef!.bottom)
} }
addConstraints(MaterialLayout.constraint(h, options: [], metrics: ["left" : leftButtonsInsetsRef!.left], views: d)) addConstraints(MaterialLayout.constraint(h, options: [], metrics: ["left" : leftButtonsInsetsRef!.left], views: d))
...@@ -281,42 +337,59 @@ public class BasicCardView: MaterialPulseView { ...@@ -281,42 +337,59 @@ public class BasicCardView: MaterialPulseView {
addSubview(b) addSubview(b)
b.layer.zPosition = 2000 b.layer.zPosition = 2000
MaterialLayout.alignFromBottom(self, child: b, bottom: rightButtonsInsetsRef!.bottom) MaterialLayout.alignFromBottom(self, child: b, bottom: contentInsetsRef!.bottom + rightButtonsInsetsRef!.bottom)
} }
addConstraints(MaterialLayout.constraint(h + "|", options: [], metrics: ["right" : rightButtonsInsetsRef!.right], views: d)) addConstraints(MaterialLayout.constraint(h + "|", options: [], metrics: ["right" : rightButtonsInsetsRef!.right], views: d))
} }
} }
if nil != titleLabel {
metrics["insetTop"] = (metrics["insetTop"] as! CGFloat) + titleLabelInsetsRef!.top
} else if nil != detailLabel {
metrics["insetTop"] = (metrics["insetTop"] as! CGFloat) + detailLabelInsetsRef!.top
}
if nil != detailLabel {
metrics["insetBottom"] = (metrics["insetBottom"] as! CGFloat) + detailLabelInsetsRef!.bottom
} else if nil != titleLabel {
metrics["insetBottom"] = (metrics["insetBottom"] as! CGFloat) + titleLabelInsetsRef!.bottom
}
if 0 < leftButtons?.count { if 0 < leftButtons?.count {
verticalFormat += "-[button]-|" verticalFormat += "-(insetC)-[button]"
views["button"] = leftButtons![0] views["button"] = leftButtons![0]
metrics["insetC"] = leftButtonsInsetsRef!.top
metrics["insetBottom"] = contentInsetsRef!.bottom + leftButtonsInsetsRef!.bottom
} else if 0 < rightButtons?.count { } else if 0 < rightButtons?.count {
verticalFormat += "-[button]-|" verticalFormat += "-(insetC)-[button]"
views["button"] = rightButtons![0] views["button"] = rightButtons![0]
} else { metrics["insetC"] = rightButtonsInsetsRef!.top
verticalFormat += "-(insetBottom)-|" metrics["insetBottom"] = contentInsetsRef!.bottom + rightButtonsInsetsRef!.bottom
}
if nil != detailLabel {
if nil == metrics["insetC"] {
metrics["insetBottom"] = contentInsetsRef!.bottom + detailLabelInsetsRef!.bottom
} else {
metrics["insetC"] = (metrics["insetC"] as! CGFloat) + detailLabelInsetsRef!.bottom
}
} else if nil != titleLabel {
if nil == metrics["insetC"] {
metrics["insetBottom"] = contentInsetsRef!.bottom + titleLabelInsetsRef!.bottom
} else {
metrics["insetC"] = (metrics["insetC"] as! CGFloat) + titleLabelInsetsRef!.bottom
}
} }
if 0 < views.count { if 0 < views.count {
verticalFormat += "-(insetBottom)-|"
addConstraints(MaterialLayout.constraint(verticalFormat, options: [], metrics: metrics, views: views)) addConstraints(MaterialLayout.constraint(verticalFormat, options: [], metrics: metrics, views: views))
} }
} }
// //
// :name: prepareDivider
//
internal func prepareDivider(y: CGFloat, width: CGFloat) {
if nil == dividerLayer {
dividerLayer = CAShapeLayer()
dividerLayer!.backgroundColor = dividerColor?.CGColor
dividerLayer!.frame = CGRectMake(0, y, width, 1)
dividerLayer!.zPosition = 900
visualLayer.addSublayer(dividerLayer!)
}
}
//
// :name: prepareProperties // :name: prepareProperties
// //
internal func prepareProperties(titleLabel: UILabel?, detailLabel: UILabel?, leftButtons: Array<MaterialButton>?, rightButtons: Array<MaterialButton>?) { internal func prepareProperties(titleLabel: UILabel?, detailLabel: UILabel?, leftButtons: Array<MaterialButton>?, rightButtons: Array<MaterialButton>?) {
...@@ -350,5 +423,6 @@ public class BasicCardView: MaterialPulseView { ...@@ -350,5 +423,6 @@ public class BasicCardView: MaterialPulseView {
cornerRadius = MaterialTheme.basicCardView.cornerRadius cornerRadius = MaterialTheme.basicCardView.cornerRadius
borderWidth = MaterialTheme.basicCardView.borderWidth borderWidth = MaterialTheme.basicCardView.borderWidth
borderColor = MaterialTheme.basicCardView.bordercolor borderColor = MaterialTheme.basicCardView.bordercolor
dividerColor = MaterialTheme.basicCardView.dividerColor
} }
} }
...@@ -21,7 +21,7 @@ import UIKit ...@@ -21,7 +21,7 @@ import UIKit
public typealias MaterialBorderType = CGFloat public typealias MaterialBorderType = CGFloat
public enum MaterialBorder { public enum MaterialBorder {
case Border0 case None
case Border1 case Border1
case Border2 case Border2
case Border3 case Border3
...@@ -33,7 +33,7 @@ public enum MaterialBorder { ...@@ -33,7 +33,7 @@ public enum MaterialBorder {
*/ */
public func MaterialBorderToValue(border: MaterialBorder) -> MaterialBorderType { public func MaterialBorderToValue(border: MaterialBorder) -> MaterialBorderType {
switch border { switch border {
case .Border0: case .None:
return 0 return 0
case .Border1: case .Border1:
return 0.5 return 0.5
......
...@@ -171,7 +171,7 @@ public class MaterialButton : UIButton { ...@@ -171,7 +171,7 @@ public class MaterialButton : UIButton {
*/ */
public var cornerRadius: MaterialRadius! { public var cornerRadius: MaterialRadius! {
didSet { didSet {
layer.cornerRadius = MaterialRadiusToValue(nil == cornerRadius ? .Radius0 : cornerRadius!) layer.cornerRadius = MaterialRadiusToValue(nil == cornerRadius ? .None : cornerRadius!)
shape = nil shape = nil
} }
} }
...@@ -197,7 +197,7 @@ public class MaterialButton : UIButton { ...@@ -197,7 +197,7 @@ public class MaterialButton : UIButton {
*/ */
public var borderWidth: MaterialBorder! { public var borderWidth: MaterialBorder! {
didSet { didSet {
layer.borderWidth = MaterialBorderToValue(nil == borderWidth ? .Border0 : borderWidth!) layer.borderWidth = MaterialBorderToValue(nil == borderWidth ? .None : borderWidth!)
} }
} }
...@@ -236,7 +236,7 @@ public class MaterialButton : UIButton { ...@@ -236,7 +236,7 @@ public class MaterialButton : UIButton {
*/ */
public var contentInsets: MaterialInsets! { public var contentInsets: MaterialInsets! {
didSet { didSet {
let value: MaterialInsetsType = MaterialInsetsToValue(nil == contentInsets ? .Rectangle0 : contentInsets) let value: MaterialInsetsType = MaterialInsetsToValue(nil == contentInsets ? .None : contentInsets)
contentEdgeInsets = UIEdgeInsetsMake(value.top, value.left, value.bottom, value.right) contentEdgeInsets = UIEdgeInsetsMake(value.top, value.left, value.bottom, value.right)
} }
} }
......
...@@ -21,7 +21,7 @@ import UIKit ...@@ -21,7 +21,7 @@ import UIKit
public typealias MaterialDepthType = (offset: CGSize, opacity: Float, radius: CGFloat) public typealias MaterialDepthType = (offset: CGSize, opacity: Float, radius: CGFloat)
public enum MaterialDepth { public enum MaterialDepth {
case Depth0 case None
case Depth1 case Depth1
case Depth2 case Depth2
case Depth3 case Depth3
...@@ -34,7 +34,7 @@ public enum MaterialDepth { ...@@ -34,7 +34,7 @@ public enum MaterialDepth {
*/ */
public func MaterialDepthToValue(depth: MaterialDepth) -> MaterialDepthType { public func MaterialDepthToValue(depth: MaterialDepth) -> MaterialDepthType {
switch depth { switch depth {
case .Depth0: case .None:
return (offset: CGSizeZero, opacity: 0, radius: 0) return (offset: CGSizeZero, opacity: 0, radius: 0)
case .Depth1: case .Depth1:
return (offset: CGSizeMake(0.2, 0.2), opacity: 0.5, radius: 1) return (offset: CGSizeMake(0.2, 0.2), opacity: 0.5, radius: 1)
......
...@@ -21,12 +21,11 @@ import UIKit ...@@ -21,12 +21,11 @@ import UIKit
public typealias MaterialInsetsType = (top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat) public typealias MaterialInsetsType = (top: CGFloat, left: CGFloat, bottom: CGFloat, right: CGFloat)
public enum MaterialInsets { public enum MaterialInsets {
case Square0 case None
case Square1 case Square1
case Square2 case Square2
case Square3 case Square3
case Square4 case Square4
case Rectangle0
case Rectangle1 case Rectangle1
case Rectangle2 case Rectangle2
case Rectangle3 case Rectangle3
...@@ -38,7 +37,7 @@ public enum MaterialInsets { ...@@ -38,7 +37,7 @@ public enum MaterialInsets {
*/ */
public func MaterialInsetsToValue(inset: MaterialInsets) -> MaterialInsetsType { public func MaterialInsetsToValue(inset: MaterialInsets) -> MaterialInsetsType {
switch inset { switch inset {
case .Square0: case .None:
return (top: 0, left: 0, bottom: 0, right: 0) return (top: 0, left: 0, bottom: 0, right: 0)
case .Square1: case .Square1:
return (top: 4, left: 4, bottom: 4, right: 4) return (top: 4, left: 4, bottom: 4, right: 4)
...@@ -48,8 +47,6 @@ public func MaterialInsetsToValue(inset: MaterialInsets) -> MaterialInsetsType { ...@@ -48,8 +47,6 @@ public func MaterialInsetsToValue(inset: MaterialInsets) -> MaterialInsetsType {
return (top: 16, left: 16, bottom: 16, right: 16) return (top: 16, left: 16, bottom: 16, right: 16)
case .Square4: case .Square4:
return (top: 32, left: 32, bottom: 32, right: 32) return (top: 32, left: 32, bottom: 32, right: 32)
case .Rectangle0:
return (top: 0, left: 0, bottom: 0, right: 0)
case .Rectangle1: case .Rectangle1:
return (top: 2, left: 4, bottom: 2, right: 4) return (top: 2, left: 4, bottom: 2, right: 4)
case .Rectangle2: case .Rectangle2:
......
...@@ -21,7 +21,7 @@ import UIKit ...@@ -21,7 +21,7 @@ import UIKit
public typealias MaterialRadiusType = CGFloat public typealias MaterialRadiusType = CGFloat
public enum MaterialRadius { public enum MaterialRadius {
case Radius0 case None
case Radius1 case Radius1
case Radius2 case Radius2
case Radius3 case Radius3
...@@ -33,7 +33,7 @@ public enum MaterialRadius { ...@@ -33,7 +33,7 @@ public enum MaterialRadius {
*/ */
public func MaterialRadiusToValue(radius: MaterialRadius) -> MaterialRadiusType { public func MaterialRadiusToValue(radius: MaterialRadius) -> MaterialRadiusType {
switch radius { switch radius {
case .Radius0: case .None:
return 0 return 0
case .Radius1: case .Radius1:
return 4 return 4
......
//
// Copyright (C) 2015 GraphKit, Inc. <http://graphkit.io> and other GraphKit contributors.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program located at the root of the software package
// in a file called LICENSE. If not, see <http://www.gnu.org/licenses/>.
//
import UIKit
public typealias MaterialSizeType = CGFloat
public enum MaterialSize {
case Size0
case Size1
case Size2
case Size3
case Size4
}
/**
:name: MaterialSizeToValue
*/
public func MaterialSizeToValue(size: MaterialSize) -> MaterialSizeType {
switch size {
case .Size0:
return 0
case .Size1:
return 0.5
case .Size2:
return 1
case .Size3:
return 2
case .Size4:
return 3
}
}
...@@ -32,15 +32,15 @@ public struct MaterialTheme { ...@@ -32,15 +32,15 @@ public struct MaterialTheme {
// view // view
public extension MaterialTheme.view { public extension MaterialTheme.view {
// shadow // shadow
public static var shadowDepth: MaterialDepth = .Depth0 public static var shadowDepth: MaterialDepth = .None
public static var shadowColor: UIColor = MaterialColor.black public static var shadowColor: UIColor = MaterialColor.black
// shape // shape
public static var masksToBounds: Bool = true public static var masksToBounds: Bool = true
public static var cornerRadius: MaterialRadius = .Radius0 public static var cornerRadius: MaterialRadius = .None
// border // border
public static var borderWidth: MaterialBorder = .Border0 public static var borderWidth: MaterialBorder = .None
public static var bordercolor: UIColor = MaterialColor.black public static var bordercolor: UIColor = MaterialColor.black
// color // color
...@@ -62,15 +62,15 @@ public extension MaterialTheme.view { ...@@ -62,15 +62,15 @@ public extension MaterialTheme.view {
// pulseView // pulseView
public extension MaterialTheme.pulseView { public extension MaterialTheme.pulseView {
// shadow // shadow
public static var shadowDepth: MaterialDepth = .Depth0 public static var shadowDepth: MaterialDepth = .None
public static var shadowColor: UIColor = MaterialColor.black public static var shadowColor: UIColor = MaterialColor.black
// shape // shape
public static var masksToBounds: Bool = true public static var masksToBounds: Bool = true
public static var cornerRadius: MaterialRadius = .Radius0 public static var cornerRadius: MaterialRadius = .None
// border // border
public static var borderWidth: MaterialBorder = .Border0 public static var borderWidth: MaterialBorder = .None
public static var bordercolor: UIColor = MaterialColor.black public static var bordercolor: UIColor = MaterialColor.black
// color // color
...@@ -99,15 +99,15 @@ public extension MaterialTheme.basicCardView { ...@@ -99,15 +99,15 @@ public extension MaterialTheme.basicCardView {
// shape // shape
public static var masksToBounds: Bool = true public static var masksToBounds: Bool = true
public static var cornerRadius: MaterialRadius = .Radius1 public static var cornerRadius: MaterialRadius = .None
public static var contentInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Square2) public static var contentInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Square3)
public static var titleLabelInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Square2) public static var titleLabelInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Square2)
public static var detailLabelInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Square2) public static var detailLabelInsetsRef: MaterialInsetsType = (top: 0, left: 8, bottom: 16, right: 8)
public static var leftButtonsInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Square2) public static var leftButtonsInsetsRef: MaterialInsetsType = (top: 8, left: 16, bottom: -8, right: 0)
public static var rightButtonsInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Square2) public static var rightButtonsInsetsRef: MaterialInsetsType = (top: 8, left: 0, bottom: -8, right: 16)
// border // border
public static var borderWidth: MaterialBorder = .Border0 public static var borderWidth: MaterialBorder = .None
public static var bordercolor: UIColor = MaterialColor.black public static var bordercolor: UIColor = MaterialColor.black
// color // color
...@@ -126,6 +126,10 @@ public extension MaterialTheme.basicCardView { ...@@ -126,6 +126,10 @@ public extension MaterialTheme.basicCardView {
// position // position
public static var zPosition: CGFloat = 0 public static var zPosition: CGFloat = 0
// divider
public static var divider: Bool = true
public static var dividerColor: UIColor = MaterialColor.blueGrey.base
} }
// navigationBarView // navigationBarView
...@@ -142,13 +146,13 @@ public extension MaterialTheme.navigationBarView { ...@@ -142,13 +146,13 @@ public extension MaterialTheme.navigationBarView {
// shape // shape
public static var masksToBounds: Bool = true public static var masksToBounds: Bool = true
public static var cornerRadius: MaterialRadius = .Radius0 public static var cornerRadius: MaterialRadius = .None
public static var titleLabelInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Rectangle3) public static var titleLabelInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Rectangle3)
public static var leftButtonsInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Square2) public static var leftButtonsInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Square2)
public static var rightButtonsInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Square2) public static var rightButtonsInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Square2)
// border // border
public static var borderWidth: MaterialBorder = .Border0 public static var borderWidth: MaterialBorder = .None
public static var bordercolor: UIColor = MaterialColor.black public static var bordercolor: UIColor = MaterialColor.black
// color // color
...@@ -184,7 +188,7 @@ public extension MaterialTheme.label { ...@@ -184,7 +188,7 @@ public extension MaterialTheme.label {
// flatButton // flatButton
public extension MaterialTheme.flatButton { public extension MaterialTheme.flatButton {
// shadow // shadow
public static var shadowDepth: MaterialDepth = .Depth0 public static var shadowDepth: MaterialDepth = .None
public static var shadowColor: UIColor = MaterialColor.black public static var shadowColor: UIColor = MaterialColor.black
// shape // shape
...@@ -194,7 +198,7 @@ public extension MaterialTheme.flatButton { ...@@ -194,7 +198,7 @@ public extension MaterialTheme.flatButton {
public static var shape: MaterialShape? = nil public static var shape: MaterialShape? = nil
// border // border
public static var borderWidth: MaterialBorder = .Border0 public static var borderWidth: MaterialBorder = .None
public static var bordercolor: UIColor = MaterialColor.black public static var bordercolor: UIColor = MaterialColor.black
// color // color
...@@ -226,7 +230,7 @@ public extension MaterialTheme.raisedButton { ...@@ -226,7 +230,7 @@ public extension MaterialTheme.raisedButton {
public static var shape: MaterialShape? = nil public static var shape: MaterialShape? = nil
// border // border
public static var borderWidth: MaterialBorder = .Border0 public static var borderWidth: MaterialBorder = .None
public static var bordercolor: UIColor = MaterialColor.black public static var bordercolor: UIColor = MaterialColor.black
// color // color
...@@ -254,12 +258,12 @@ public extension MaterialTheme.fabButton { ...@@ -254,12 +258,12 @@ public extension MaterialTheme.fabButton {
// shape // shape
public static var masksToBounds: Bool = true public static var masksToBounds: Bool = true
public static var cornerRadius: MaterialRadius = .Radius0 public static var cornerRadius: MaterialRadius = .None
public static var contentInsets: MaterialInsets = .Rectangle0 public static var contentInsets: MaterialInsets = .None
public static var shape: MaterialShape? = .Circle public static var shape: MaterialShape? = .Circle
// border // border
public static var borderWidth: MaterialBorder = .Border0 public static var borderWidth: MaterialBorder = .None
public static var bordercolor: UIColor = MaterialColor.black public static var bordercolor: UIColor = MaterialColor.black
// color // color
......
...@@ -187,7 +187,7 @@ public class MaterialView: UIView { ...@@ -187,7 +187,7 @@ public class MaterialView: UIView {
*/ */
public var cornerRadius: MaterialRadius! { public var cornerRadius: MaterialRadius! {
didSet { didSet {
layer.cornerRadius = MaterialRadiusToValue(nil == cornerRadius ? .Radius0 : cornerRadius!) layer.cornerRadius = MaterialRadiusToValue(nil == cornerRadius ? .None : cornerRadius!)
shape = nil shape = nil
} }
} }
...@@ -213,7 +213,7 @@ public class MaterialView: UIView { ...@@ -213,7 +213,7 @@ public class MaterialView: UIView {
*/ */
public var borderWidth: MaterialBorder! { public var borderWidth: MaterialBorder! {
didSet { didSet {
layer.borderWidth = MaterialBorderToValue(nil == borderWidth ? .Border0 : borderWidth!) layer.borderWidth = MaterialBorderToValue(nil == borderWidth ? .None : borderWidth!)
} }
} }
......
//
// Copyright (C) 2015 GraphKit, Inc. <http://graphkit.io> and other GraphKit contributors.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program located at the root of the software package
// in a file called LICENSE. If not, see <http://www.gnu.org/licenses/>.
//
import UIKit
public extension UIView {
/**
:name: sideNavigationView
*/
public var sideNavigationView: SideNavigationView? {
var v: UIView? = self
while nil != v {
if v is SideNavigationView {
return v as? SideNavigationView
}
v = v?.superview
}
return nil
}
}
@objc(SideNavigationView)
public class SideNavigationView: MaterialView, UIGestureRecognizerDelegate {
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment