Commit 35e5adc6 by Daniel Dahan

preparing for release 1.22.0

parent 789161bf
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
965C17C71BC8279F00B1059A /* BasicCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965C17C61BC8279F00B1059A /* BasicCollectionViewCell.swift */; settings = {ASSET_TAGS = (); }; }; 965C17C71BC8279F00B1059A /* BasicCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 965C17C61BC8279F00B1059A /* BasicCollectionViewCell.swift */; settings = {ASSET_TAGS = (); }; };
965C17C81BC82FEF00B1059A /* MaterialLayer.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65AD15E91BC05B3A0068AF9C /* MaterialLayer.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 965C17C81BC82FEF00B1059A /* MaterialLayer.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65AD15E91BC05B3A0068AF9C /* MaterialLayer.swift */; settings = {ATTRIBUTES = (Public, ); }; };
965C17C91BC82FEF00B1059A /* MaterialTextLayer.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9699879B1BC5FE49006D678E /* MaterialTextLayer.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 965C17C91BC82FEF00B1059A /* MaterialTextLayer.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9699879B1BC5FE49006D678E /* MaterialTextLayer.swift */; settings = {ATTRIBUTES = (Public, ); }; };
965C17CA1BC82FEF00B1059A /* CardView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D26BFC1BC23649006478BD /* CardView.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 965C17CA1BC82FEF00B1059A /* ImageCardView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D26BFC1BC23649006478BD /* ImageCardView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
965C17CB1BC82FEF00B1059A /* MaterialCollectionViewCell.swift in Headers */ = {isa = PBXBuildFile; fileRef = 965C17C41BC8273D00B1059A /* MaterialCollectionViewCell.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 965C17CB1BC82FEF00B1059A /* MaterialCollectionViewCell.swift in Headers */ = {isa = PBXBuildFile; fileRef = 965C17C41BC8273D00B1059A /* MaterialCollectionViewCell.swift */; settings = {ATTRIBUTES = (Public, ); }; };
965C17CC1BC82FEF00B1059A /* BasicCollectionViewCell.swift in Headers */ = {isa = PBXBuildFile; fileRef = 965C17C61BC8279F00B1059A /* BasicCollectionViewCell.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 965C17CC1BC82FEF00B1059A /* BasicCollectionViewCell.swift in Headers */ = {isa = PBXBuildFile; fileRef = 965C17C61BC8279F00B1059A /* BasicCollectionViewCell.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9693BF861BCB0E0A0087054A /* Material+UIFont.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9693BF851BCB0E0A0087054A /* Material+UIFont.swift */; settings = {ASSET_TAGS = (); }; }; 9693BF861BCB0E0A0087054A /* Material+UIFont.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9693BF851BCB0E0A0087054A /* Material+UIFont.swift */; settings = {ASSET_TAGS = (); }; };
...@@ -70,9 +70,11 @@ ...@@ -70,9 +70,11 @@
9693BF8D1BCB35910087054A /* MaterialBasicAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65D2BEC61BBED1E400800B7B /* MaterialBasicAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 9693BF8D1BCB35910087054A /* MaterialBasicAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65D2BEC61BBED1E400800B7B /* MaterialBasicAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9693BF8E1BCB35910087054A /* MaterialKeyframeAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65D2BEC81BBED1FA00800B7B /* MaterialKeyframeAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 9693BF8E1BCB35910087054A /* MaterialKeyframeAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65D2BEC81BBED1FA00800B7B /* MaterialKeyframeAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9693BF8F1BCB35910087054A /* MaterialTransitionAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96C4FABD1BC3168900E4FFC3 /* MaterialTransitionAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 9693BF8F1BCB35910087054A /* MaterialTransitionAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96C4FABD1BC3168900E4FFC3 /* MaterialTransitionAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9693BF961BCCCB520087054A /* BasicCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9693BF951BCCCB520087054A /* BasicCardView.swift */; settings = {ASSET_TAGS = (); }; };
9693BF971BCCCCB30087054A /* BasicCardView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9693BF951BCCCB520087054A /* BasicCardView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9699879C1BC5FE49006D678E /* MaterialTextLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9699879B1BC5FE49006D678E /* MaterialTextLayer.swift */; settings = {ASSET_TAGS = (); }; }; 9699879C1BC5FE49006D678E /* MaterialTextLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9699879B1BC5FE49006D678E /* MaterialTextLayer.swift */; settings = {ASSET_TAGS = (); }; };
96C4FABE1BC3168900E4FFC3 /* MaterialTransitionAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96C4FABD1BC3168900E4FFC3 /* MaterialTransitionAnimation.swift */; settings = {ASSET_TAGS = (); }; }; 96C4FABE1BC3168900E4FFC3 /* MaterialTransitionAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96C4FABD1BC3168900E4FFC3 /* MaterialTransitionAnimation.swift */; settings = {ASSET_TAGS = (); }; };
96D26BFD1BC23649006478BD /* CardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D26BFC1BC23649006478BD /* CardView.swift */; settings = {ASSET_TAGS = (); }; }; 96D26BFD1BC23649006478BD /* ImageCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D26BFC1BC23649006478BD /* ImageCardView.swift */; settings = {ASSET_TAGS = (); }; };
9A94D0FA1B895EA500F586A5 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 963832631B88E5BF0015F710 /* LICENSE */; }; 9A94D0FA1B895EA500F586A5 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 963832631B88E5BF0015F710 /* LICENSE */; };
9A94D0FB1B895EA500F586A5 /* Roboto-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9AAC38591B8956E300FE6B2D /* Roboto-Regular.ttf */; }; 9A94D0FB1B895EA500F586A5 /* Roboto-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9AAC38591B8956E300FE6B2D /* Roboto-Regular.ttf */; };
9A94D0FC1B895EA500F586A5 /* Roboto-Medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9AAC38571B8956CF00FE6B2D /* Roboto-Medium.ttf */; }; 9A94D0FC1B895EA500F586A5 /* Roboto-Medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9AAC38571B8956CF00FE6B2D /* Roboto-Medium.ttf */; };
...@@ -126,9 +128,10 @@ ...@@ -126,9 +128,10 @@
965C17C61BC8279F00B1059A /* BasicCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicCollectionViewCell.swift; sourceTree = "<group>"; }; 965C17C61BC8279F00B1059A /* BasicCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicCollectionViewCell.swift; sourceTree = "<group>"; };
9693BF851BCB0E0A0087054A /* Material+UIFont.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIFont.swift"; sourceTree = "<group>"; }; 9693BF851BCB0E0A0087054A /* Material+UIFont.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIFont.swift"; sourceTree = "<group>"; };
9693BF891BCB35520087054A /* SideNavigationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SideNavigationViewController.swift; sourceTree = "<group>"; }; 9693BF891BCB35520087054A /* SideNavigationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SideNavigationViewController.swift; sourceTree = "<group>"; };
9693BF951BCCCB520087054A /* BasicCardView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicCardView.swift; sourceTree = "<group>"; };
9699879B1BC5FE49006D678E /* MaterialTextLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTextLayer.swift; sourceTree = "<group>"; }; 9699879B1BC5FE49006D678E /* MaterialTextLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTextLayer.swift; sourceTree = "<group>"; };
96C4FABD1BC3168900E4FFC3 /* MaterialTransitionAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTransitionAnimation.swift; sourceTree = "<group>"; }; 96C4FABD1BC3168900E4FFC3 /* MaterialTransitionAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTransitionAnimation.swift; sourceTree = "<group>"; };
96D26BFC1BC23649006478BD /* CardView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardView.swift; sourceTree = "<group>"; }; 96D26BFC1BC23649006478BD /* ImageCardView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageCardView.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>"; };
9AAC38591B8956E300FE6B2D /* Roboto-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Regular.ttf"; sourceTree = "<group>"; }; 9AAC38591B8956E300FE6B2D /* Roboto-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Roboto-Regular.ttf"; sourceTree = "<group>"; };
...@@ -289,7 +292,8 @@ ...@@ -289,7 +292,8 @@
964B17D71BBB38E2002A9CA0 /* Card */ = { 964B17D71BBB38E2002A9CA0 /* Card */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96D26BFC1BC23649006478BD /* CardView.swift */, 9693BF951BCCCB520087054A /* BasicCardView.swift */,
96D26BFC1BC23649006478BD /* ImageCardView.swift */,
); );
name = Card; name = Card;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -375,7 +379,8 @@ ...@@ -375,7 +379,8 @@
964B17D61BBB31C2002A9CA0 /* MaterialLayout.swift in Headers */, 964B17D61BBB31C2002A9CA0 /* MaterialLayout.swift in Headers */,
965C17C81BC82FEF00B1059A /* MaterialLayer.swift in Headers */, 965C17C81BC82FEF00B1059A /* MaterialLayer.swift in Headers */,
965C17C91BC82FEF00B1059A /* MaterialTextLayer.swift in Headers */, 965C17C91BC82FEF00B1059A /* MaterialTextLayer.swift in Headers */,
965C17CA1BC82FEF00B1059A /* CardView.swift in Headers */, 9693BF971BCCCCB30087054A /* BasicCardView.swift in Headers */,
965C17CA1BC82FEF00B1059A /* ImageCardView.swift in Headers */,
965C17CB1BC82FEF00B1059A /* MaterialCollectionViewCell.swift in Headers */, 965C17CB1BC82FEF00B1059A /* MaterialCollectionViewCell.swift in Headers */,
965C17CC1BC82FEF00B1059A /* BasicCollectionViewCell.swift in Headers */, 965C17CC1BC82FEF00B1059A /* BasicCollectionViewCell.swift in Headers */,
9693BF8B1BCB35910087054A /* Material+UIFont.swift in Headers */, 9693BF8B1BCB35910087054A /* Material+UIFont.swift in Headers */,
...@@ -495,7 +500,8 @@ ...@@ -495,7 +500,8 @@
65BDD16C1BB88D1A006F7F2B /* MaterialShape.swift in Sources */, 65BDD16C1BB88D1A006F7F2B /* MaterialShape.swift in Sources */,
65AD15EA1BC05B3A0068AF9C /* MaterialLayer.swift in Sources */, 65AD15EA1BC05B3A0068AF9C /* MaterialLayer.swift in Sources */,
65BDD1521BB6EE7C006F7F2B /* RobotoFont.swift in Sources */, 65BDD1521BB6EE7C006F7F2B /* RobotoFont.swift in Sources */,
96D26BFD1BC23649006478BD /* CardView.swift in Sources */, 9693BF961BCCCB520087054A /* BasicCardView.swift in Sources */,
96D26BFD1BC23649006478BD /* ImageCardView.swift in Sources */,
65BDD1591BB6FE3E006F7F2B /* FlatButton.swift in Sources */, 65BDD1591BB6FE3E006F7F2B /* FlatButton.swift in Sources */,
65BDD1791BB99C0F006F7F2B /* RaisedButton.swift in Sources */, 65BDD1791BB99C0F006F7F2B /* RaisedButton.swift in Sources */,
964B17B41BBA447F002A9CA0 /* MaterialLayout.swift in Sources */, 964B17B41BBA447F002A9CA0 /* MaterialLayout.swift in Sources */,
......
...@@ -8,15 +8,15 @@ MaterialKit is on CocoaPods under the name [MK](https://cocoapods.org/?q=MK). ...@@ -8,15 +8,15 @@ MaterialKit is on CocoaPods under the name [MK](https://cocoapods.org/?q=MK).
To get started, let's introduce MaterialView, a lightweight UIView Object that has flexibility in mind. Common controls have been added to make things easier. For example, let's make a circle view that has a shadow, border, and image. To get started, let's introduce MaterialView, a lightweight UIView Object that has flexibility in mind. Common controls have been added to make things easier. For example, let's make a circle view that has a shadow, border, and image.
![MKPreview](http://www.materialkit.io/github/img1.gif) ![MKPreview](http://www.materialkit.io/github/vid1.gif)
```swift ```swift
let v: MaterialView = MaterialView(frame: CGRectMake(87.5, 87.5, 200, 200)) let v: MaterialView = MaterialView(frame: CGRectMake(107, 107, 200, 200))
v.shape = .Circle v.shape = .Circle
v.shadowDepth = .Depth3 v.shadowDepth = .Depth3
v.borderWidth = .Border4 v.borderWidth = .Border4
v.borderColor = MaterialColor.blue.accent3 v.borderColor = MaterialColor.blue.accent4
v.image = UIImage(named: "img1") v.image = UIImage(named: "img2")
// Add to UIViewController. // Add to UIViewController.
view.addSubview(v) view.addSubview(v)
...@@ -26,10 +26,10 @@ view.addSubview(v) ...@@ -26,10 +26,10 @@ view.addSubview(v)
Let's expand on the basic MaterialView and use an animated MaterialPulseView. In this example, we will make the shape a square with some rounded corners. Let's expand on the basic MaterialView and use an animated MaterialPulseView. In this example, we will make the shape a square with some rounded corners.
![MKPreview](http://www.materialkit.io/github/img2.gif) ![MKPreview](http://www.materialkit.io/github/vid2.gif)
```swift ```swift
let v: MaterialPulseView = MaterialPulseView(frame: CGRectMake(87.5, 87.5, 200, 200)) let v: MaterialPulseView = MaterialPulseView(frame: CGRectMake(107, 107, 200, 200))
v.shape = .Square v.shape = .Square
v.shadowDepth = .Depth3 v.shadowDepth = .Depth3
v.cornerRadius = .Radius3 v.cornerRadius = .Radius3
...@@ -43,10 +43,10 @@ view.addSubview(v) ...@@ -43,10 +43,10 @@ view.addSubview(v)
A FlatButton is the best place to start when introducing MaterialKit buttons. It is simple, clean, and very effective. Below is an example of a FlatButton in action. A FlatButton is the best place to start when introducing MaterialKit buttons. It is simple, clean, and very effective. Below is an example of a FlatButton in action.
![MKPreview](http://www.materialkit.io/github/img3.gif) ![MKPreview](http://www.materialkit.io/github/vid3.gif)
```swift ```swift
let v: FlatButton = FlatButton(frame: CGRectMake(100, 100, 200, 64)) let v: FlatButton = FlatButton(frame: CGRectMake(107, 107, 200, 200))
v.setTitle("Flat", forState: .Normal) v.setTitle("Flat", forState: .Normal)
v.titleLabel!.font = RobotoFont.mediumWithSize(32) v.titleLabel!.font = RobotoFont.mediumWithSize(32)
...@@ -58,10 +58,10 @@ view.addSubview(v) ...@@ -58,10 +58,10 @@ view.addSubview(v)
A RaisedButton is sure to get attention. Take a look at the following code sample. A RaisedButton is sure to get attention. Take a look at the following code sample.
![MKPreview](http://www.materialkit.io/github/img4.gif) ![MKPreview](http://www.materialkit.io/github/vid4.gif)
```swift ```swift
let v: RaisedButton = RaisedButton(frame: CGRectMake(100, 100, 200, 64)) let v: RaisedButton = RaisedButton(frame: CGRectMake(107, 107, 200, 200))
v.setTitle("Raised", forState: .Normal) v.setTitle("Raised", forState: .Normal)
v.titleLabel!.font = RobotoFont.mediumWithSize(32) v.titleLabel!.font = RobotoFont.mediumWithSize(32)
...@@ -73,10 +73,10 @@ view.addSubview(v) ...@@ -73,10 +73,10 @@ view.addSubview(v)
A FabButton is essential to Material Design's overall look. I leave this example as simple as possible to showcase its beauty. A FabButton is essential to Material Design's overall look. I leave this example as simple as possible to showcase its beauty.
![MKPreview](http://www.materialkit.io/github/img5.gif) ![MKPreview](http://www.materialkit.io/github/vid5.gif)
```swift ```swift
let v: FabButton = FabButton(frame: CGRectMake(100, 100, 64, 64)) let v: FabButton = FabButton(frame: CGRectMake(175, 175, 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)
...@@ -88,14 +88,13 @@ view.addSubview(v) ...@@ -88,14 +88,13 @@ view.addSubview(v)
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.
![MKPreview](http://www.materialkit.io/github/img6.gif) ![MKPreview](http://www.materialkit.io/github/vid6.gif)
```swift ```swift
let v: NavigationBarView = NavigationBarView(titleLabel: MaterialLabel())! let v: NavigationBarView = NavigationBarView(titleLabel: MaterialLabel())!
v.backgroundColor = MaterialColor.blue.accent3 v.backgroundColor = MaterialColor.blue.accent3
v.statusBarStyle = .LightContent v.statusBarStyle = .LightContent
v.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
...@@ -143,7 +142,7 @@ view.addSubview(v) ...@@ -143,7 +142,7 @@ view.addSubview(v)
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. 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.
![MKPreview](http://www.materialkit.io/github/img7.gif) ![MKPreview](http://www.materialkit.io/github/vid7.gif)
```swift ```swift
let v: BasicCardView = BasicCardView(titleLabel: UILabel(), detailLabel: UILabel())! let v: BasicCardView = BasicCardView(titleLabel: UILabel(), detailLabel: UILabel())!
...@@ -151,11 +150,10 @@ v.backgroundColor = MaterialColor.blueGrey.darken1 ...@@ -151,11 +150,10 @@ v.backgroundColor = MaterialColor.blueGrey.darken1
v.dividerColor = MaterialColor.blueGrey.base v.dividerColor = MaterialColor.blueGrey.base
v.titleLabel!.textColor = MaterialColor.white v.titleLabel!.textColor = MaterialColor.white
v.titleLabel!.font = RobotoFont.regularWithSize(18) v.titleLabel!.font = RobotoFont.regularWithSize(24)
v.titleLabel!.text = "Card Title" v.titleLabel!.text = "Card Title"
v.detailLabel!.textColor = MaterialColor.white v.detailLabel!.textColor = MaterialColor.white
v.detailLabel!.font = RobotoFont.regularWithSize(14)
v.detailLabel!.lineBreakMode = .ByWordWrapping v.detailLabel!.lineBreakMode = .ByWordWrapping
v.detailLabel!.numberOfLines = 0 v.detailLabel!.numberOfLines = 0
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." 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."
...@@ -197,23 +195,28 @@ MaterialLayout.alignFromTop(view, child: v, top: 100) ...@@ -197,23 +195,28 @@ 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. A BasicCardView can easily add an image as its background, below is the code that shows how to do this.
![MKPreview](http://www.materialkit.io/github/img8.gif) ![MKPreview](http://www.materialkit.io/github/vid8.gif)
```swift ```swift
let v: BasicCardView = BasicCardView(titleLabel: MaterialLabel(), detailLabel: MaterialLabel())! let v: BasicCardView = BasicCardView(image: UIImage(named: "img2"), titleLabel: MaterialLabel(), detailLabel: MaterialLabel())!
v.spotlight = true v.spotlight = true
v.image = UIImage(named: "img4") v.divider = false
v.titleLabel!.textColor = MaterialColor.white v.titleLabel!.textColor = MaterialColor.white
v.titleLabel!.font = RobotoFont.regularWithSize(18) v.titleLabel!.font = RobotoFont.regularWithSize(24)
v.titleLabel!.text = "Card Title" v.titleLabel!.text = "Card Title"
v.detailLabel!.textColor = MaterialColor.white v.detailLabel!.textColor = MaterialColor.white
v.detailLabel!.font = RobotoFont.regularWithSize(14)
v.detailLabel!.lineBreakMode = .ByWordWrapping v.detailLabel!.lineBreakMode = .ByWordWrapping
v.detailLabel!.numberOfLines = 0 v.detailLabel!.numberOfLines = 0
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." 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.setImage(UIImage(named: "ic_star_white"), forState: .Normal)
b1.setImage(UIImage(named: "ic_star_white"), forState: .Highlighted)
b1.pulseColor = MaterialColor.white
v.rightButtons = [b1]
// Add to UIViewController // Add to UIViewController
view.addSubview(v) view.addSubview(v)
...@@ -226,10 +229,10 @@ MaterialLayout.alignFromTop(view, child: v, top: 100) ...@@ -226,10 +229,10 @@ MaterialLayout.alignFromTop(view, child: v, top: 100)
An ImageCardView is a great way to enclose many components into a single and presentable layout. Below is an example of setting one up. An ImageCardView is a great way to enclose many components into a single and presentable layout. Below is an example of setting one up.
![MKPreview](http://www.materialkit.io/github/img10.gif) ![MKPreview](http://www.materialkit.io/github/vid9.gif)
```swift ```swift
let v: ImageCardView = ImageCardView(image: UIImage(named: "img4"))! let v: ImageCardView = ImageCardView(image: UIImage(named: "img2"))!
v.pulseColor = MaterialColor.blueGrey.lighten4 v.pulseColor = MaterialColor.blueGrey.lighten4
v.pulseFill = true v.pulseFill = true
...@@ -237,10 +240,8 @@ v.titleLabel = MaterialLabel() ...@@ -237,10 +240,8 @@ v.titleLabel = MaterialLabel()
v.titleLabel!.textColor = MaterialColor.white v.titleLabel!.textColor = MaterialColor.white
v.titleLabel!.font = RobotoFont.regularWithSize(24) v.titleLabel!.font = RobotoFont.regularWithSize(24)
v.titleLabel!.text = "Card Title" v.titleLabel!.text = "Card Title"
v.titleLabelInsetsRef!.top = 136
v.detailLabel = MaterialLabel() v.detailLabel = MaterialLabel()
v.detailLabel!.font = RobotoFont.regularWithSize(14)
v.detailLabel!.lineBreakMode = .ByWordWrapping v.detailLabel!.lineBreakMode = .ByWordWrapping
v.detailLabel!.numberOfLines = 0 v.detailLabel!.numberOfLines = 0
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." 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."
...@@ -271,15 +272,16 @@ MaterialLayout.alignFromTop(view, child: v, top: 100) ...@@ -271,15 +272,16 @@ MaterialLayout.alignFromTop(view, child: v, top: 100)
Animations are a wonderful way to add life to your application. MaterialAnimation is a lightweight API for constructing complex animations. Below is an example of an animation. Animations are a wonderful way to add life to your application. MaterialAnimation is a lightweight API for constructing complex animations. Below is an example of an animation.
![MKPreview](http://www.materialkit.io/github/img9.gif) ![MKPreview](http://www.materialkit.io/github/vid10.gif)
```swift ```swift
let v: MaterialPulseView = MaterialPulseView(frame: CGRectMake(50, 50, 200, 200)) let v: MaterialPulseView = MaterialPulseView(frame: CGRectMake(107, 107, 200, 200))
v.spotlight = true v.spotlight = true
v.shape = .Circle v.shape = .Circle
v.shadowDepth = .Depth2 v.shadowDepth = .Depth3
v.borderWidth = .Border1 v.borderWidth = .Border5
v.backgroundColor = MaterialColor.blue.accent3 v.borderColor = MaterialColor.blue.accent4
v.backgroundColor = MaterialColor.amber.base
// Add to UIViewController. // Add to UIViewController.
view.addSubview(v) view.addSubview(v)
...@@ -287,7 +289,7 @@ view.addSubview(v) ...@@ -287,7 +289,7 @@ view.addSubview(v)
// Play animation group. // Play animation group.
v.animation(MaterialAnimation.animationGroup([ v.animation(MaterialAnimation.animationGroup([
MaterialAnimation.rotation(3), MaterialAnimation.rotation(3),
MaterialAnimation.position(CGPointMake(225, 400)), MaterialAnimation.position(CGPointMake(207, 400)),
MaterialAnimation.cornerRadius(30), MaterialAnimation.cornerRadius(30),
MaterialAnimation.backgroundColor(MaterialColor.red.darken1) MaterialAnimation.backgroundColor(MaterialColor.red.darken1)
], duration: 1)) ], duration: 1))
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
import UIKit import UIKit
public class CardView : MaterialPulseView { public class ImageCardView : MaterialPulseView {
// //
// :name: dividerLayer // :name: dividerLayer
// //
...@@ -36,7 +36,7 @@ public class CardView : MaterialPulseView { ...@@ -36,7 +36,7 @@ public class CardView : MaterialPulseView {
/** /**
:name: divider :name: divider
*/ */
public var divider: Bool = MaterialTheme.cardView.divider { public var divider: Bool = MaterialTheme.imageCardView.divider {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -64,44 +64,48 @@ public class CardView : MaterialPulseView { ...@@ -64,44 +64,48 @@ public class CardView : MaterialPulseView {
/** /**
:name: imageLayer :name: imageLayer
*/ */
public private(set) lazy var imageLayer: CAShapeLayer = CAShapeLayer() public private(set) var imageLayer: CAShapeLayer?
/** /**
:name: image :name: image
*/ */
public override var image: UIImage? { public override var image: UIImage? {
get { get {
return nil == imageLayer.contents ? nil : UIImage(CGImage: imageLayer.contents as! CGImage) return nil == imageLayer?.contents ? nil : UIImage(CGImage: imageLayer?.contents as! CGImage)
} }
set(value) { set(value) {
if let v = value { if let v = value {
imageLayer.contents = v.CGImage prepareImageLayer()
if 0 == maxImageSize { imageLayer?.contents = v.CGImage
if 0 == imageLayer.frame.size.height { if 0 == maxImageHeight {
imageLayer.frame.size.height = v.size.height imageLayer?.frame.size.height = image!.size.height / contentsScale
}
} else { } else {
imageLayer.frame.size.height = maxImageSize let h: CGFloat = image!.size.height / contentsScale
imageLayer?.frame.size.height = maxImageHeight < h ? maxImageHeight : h
} }
imageLayer.hidden = false imageLayer?.hidden = false
} } else {
else { imageLayer?.contents = nil
imageLayer.contents = nil imageLayer?.frame = CGRectZero
imageLayer.frame = CGRectZero imageLayer?.hidden = true
imageLayer.hidden = true imageLayer?.removeFromSuperlayer()
} }
reloadView() reloadView()
} }
} }
/** /**
:name: maxImageSize :name: maxImageHeight
*/ */
public var maxImageSize: CGFloat = 0 { public var maxImageHeight: CGFloat = 0 {
didSet { didSet {
if 0 < maxImageSize { if 0 < maxImageHeight {
imageLayer.frame.size.height = maxImageSize prepareImageLayer()
// imageLayer.contentsGravity = MaterialGravityToString(contentsGravity) let h: CGFloat = image!.size.height / contentsScale
imageLayer?.frame.size.height = maxImageHeight < h ? maxImageHeight : h
} else {
maxImageHeight = 0
imageLayer?.frame.size.height = nil == image ? 0 : image!.size.height / contentsScale
} }
reloadView() reloadView()
} }
...@@ -112,7 +116,8 @@ public class CardView : MaterialPulseView { ...@@ -112,7 +116,8 @@ public class CardView : MaterialPulseView {
*/ */
public override var contentsRect: CGRect { public override var contentsRect: CGRect {
didSet { didSet {
imageLayer.contentsRect = contentsRect prepareImageLayer()
imageLayer?.contentsRect = contentsRect
} }
} }
...@@ -121,7 +126,8 @@ public class CardView : MaterialPulseView { ...@@ -121,7 +126,8 @@ public class CardView : MaterialPulseView {
*/ */
public override var contentsCenter: CGRect { public override var contentsCenter: CGRect {
didSet { didSet {
imageLayer.contentsCenter = contentsCenter prepareImageLayer()
imageLayer?.contentsCenter = contentsCenter
} }
} }
...@@ -130,7 +136,8 @@ public class CardView : MaterialPulseView { ...@@ -130,7 +136,8 @@ public class CardView : MaterialPulseView {
*/ */
public override var contentsScale: CGFloat { public override var contentsScale: CGFloat {
didSet { didSet {
imageLayer.contentsScale = contentsScale prepareImageLayer()
imageLayer?.contentsScale = contentsScale
} }
} }
...@@ -139,7 +146,8 @@ public class CardView : MaterialPulseView { ...@@ -139,7 +146,8 @@ public class CardView : MaterialPulseView {
*/ */
public override var contentsGravity: MaterialGravity { public override var contentsGravity: MaterialGravity {
didSet { didSet {
imageLayer.contentsGravity = MaterialGravityToString(contentsGravity) prepareImageLayer()
imageLayer?.contentsGravity = MaterialGravityToString(contentsGravity)
} }
} }
...@@ -322,23 +330,29 @@ public class CardView : MaterialPulseView { ...@@ -322,23 +330,29 @@ public class CardView : MaterialPulseView {
*/ */
public override func layoutSubviews() { public override func layoutSubviews() {
super.layoutSubviews() super.layoutSubviews()
// image imageLayer?.frame.size.width = bounds.size.width
imageLayer.frame.size.width = bounds.size.width }
// divider /**
if divider { :name: layoutSublayersOfLayer
var y: CGFloat = contentInsetsRef!.bottom + dividerInsetsRef!.bottom */
if 0 < leftButtons?.count { public override func layoutSublayersOfLayer(layer: CALayer) {
y += leftButtonsInsetsRef!.top + leftButtonsInsetsRef!.bottom + leftButtons![0].frame.size.height super.layoutSublayersOfLayer(layer)
} else if 0 < rightButtons?.count { if self.layer == layer {
y += rightButtonsInsetsRef!.top + rightButtonsInsetsRef!.bottom + rightButtons![0].frame.size.height if divider {
} var y: CGFloat = contentInsetsRef!.bottom + dividerInsetsRef!.bottom
if 0 < y { if 0 < leftButtons?.count {
prepareDivider(bounds.size.height - y - 0.5, width: bounds.size.width) y += leftButtonsInsetsRef!.top + leftButtonsInsetsRef!.bottom + leftButtons![0].frame.size.height
} else if 0 < rightButtons?.count {
y += rightButtonsInsetsRef!.top + rightButtonsInsetsRef!.bottom + rightButtons![0].frame.size.height
}
if 0 < y {
prepareDivider(bounds.size.height - y - 0.5, width: bounds.size.width)
}
} else {
dividerLayer?.removeFromSuperlayer()
dividerLayer = nil
} }
} else {
dividerLayer?.removeFromSuperlayer()
dividerLayer = nil
} }
} }
...@@ -347,27 +361,27 @@ public class CardView : MaterialPulseView { ...@@ -347,27 +361,27 @@ public class CardView : MaterialPulseView {
*/ */
public override func prepareView() { public override func prepareView() {
super.prepareView() super.prepareView()
userInteractionEnabled = MaterialTheme.cardView.userInteractionEnabled userInteractionEnabled = MaterialTheme.imageCardView.userInteractionEnabled
backgroundColor = MaterialTheme.cardView.backgroundColor backgroundColor = MaterialTheme.imageCardView.backgroundColor
pulseColor = MaterialTheme.cardView.pulseColor pulseColor = MaterialTheme.imageCardView.pulseColor
contentInsetsRef = MaterialTheme.cardView.contentInsetsRef contentInsetsRef = MaterialTheme.imageCardView.contentInsetsRef
titleLabelInsetsRef = MaterialTheme.cardView.titleLabelInsetsRef titleLabelInsetsRef = MaterialTheme.imageCardView.titleLabelInsetsRef
detailLabelInsetsRef = MaterialTheme.cardView.detailLabelInsetsRef detailLabelInsetsRef = MaterialTheme.imageCardView.detailLabelInsetsRef
leftButtonsInsetsRef = MaterialTheme.cardView.leftButtonsInsetsRef leftButtonsInsetsRef = MaterialTheme.imageCardView.leftButtonsInsetsRef
rightButtonsInsetsRef = MaterialTheme.cardView.rightButtonsInsetsRef rightButtonsInsetsRef = MaterialTheme.imageCardView.rightButtonsInsetsRef
dividerInsetsRef = MaterialTheme.cardView.dividerInsetsRef dividerInsetsRef = MaterialTheme.imageCardView.dividerInsetsRef
contentsRect = MaterialTheme.cardView.contentsRect contentsRect = MaterialTheme.imageCardView.contentsRect
contentsCenter = MaterialTheme.cardView.contentsCenter contentsCenter = MaterialTheme.imageCardView.contentsCenter
contentsScale = MaterialTheme.cardView.contentsScale contentsScale = MaterialTheme.imageCardView.contentsScale
contentsGravity = MaterialTheme.cardView.contentsGravity contentsGravity = MaterialTheme.imageCardView.contentsGravity
shadowDepth = MaterialTheme.cardView.shadowDepth shadowDepth = MaterialTheme.imageCardView.shadowDepth
shadowColor = MaterialTheme.cardView.shadowColor shadowColor = MaterialTheme.imageCardView.shadowColor
zPosition = MaterialTheme.cardView.zPosition zPosition = MaterialTheme.imageCardView.zPosition
borderWidth = MaterialTheme.cardView.borderWidth borderWidth = MaterialTheme.imageCardView.borderWidth
borderColor = MaterialTheme.cardView.bordercolor borderColor = MaterialTheme.imageCardView.bordercolor
dividerColor = MaterialTheme.cardView.dividerColor dividerColor = MaterialTheme.imageCardView.dividerColor
} }
/** /**
...@@ -384,9 +398,9 @@ public class CardView : MaterialPulseView { ...@@ -384,9 +398,9 @@ public class CardView : MaterialPulseView {
var views: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>() var views: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
var metrics: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>() var metrics: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
if nil != imageLayer.contents { if nil != imageLayer?.contents {
verticalFormat += "-(insetTop)" verticalFormat += "-(insetTop)"
metrics["insetTop"] = imageLayer.frame.size.height metrics["insetTop"] = imageLayer?.frame.size.height
} else if nil != titleLabel { } else if nil != titleLabel {
verticalFormat += "-(insetTop)" verticalFormat += "-(insetTop)"
metrics["insetTop"] = contentInsetsRef!.top + titleLabelInsetsRef!.top metrics["insetTop"] = contentInsetsRef!.top + titleLabelInsetsRef!.top
...@@ -399,7 +413,7 @@ public class CardView : MaterialPulseView { ...@@ -399,7 +413,7 @@ public class CardView : MaterialPulseView {
if let v = titleLabel { if let v = titleLabel {
addSubview(v) addSubview(v)
if nil == imageLayer.contents { if nil == imageLayer?.contents {
verticalFormat += "-[titleLabel]" verticalFormat += "-[titleLabel]"
views["titleLabel"] = v views["titleLabel"] = v
} else { } else {
...@@ -412,7 +426,7 @@ public class CardView : MaterialPulseView { ...@@ -412,7 +426,7 @@ public class CardView : MaterialPulseView {
if let v = detailLabel { if let v = detailLabel {
addSubview(v) addSubview(v)
if nil == imageLayer.contents && nil != titleLabel { if nil == imageLayer?.contents && nil != titleLabel {
verticalFormat += "-(insetB)" verticalFormat += "-(insetB)"
metrics["insetB"] = titleLabelInsetsRef!.bottom + detailLabelInsetsRef!.top metrics["insetB"] = titleLabelInsetsRef!.bottom + detailLabelInsetsRef!.top
} else { } else {
...@@ -480,7 +494,7 @@ public class CardView : MaterialPulseView { ...@@ -480,7 +494,7 @@ public class CardView : MaterialPulseView {
} }
} }
if nil == imageLayer.contents { if nil == imageLayer?.contents {
if 0 < leftButtons?.count { if 0 < leftButtons?.count {
verticalFormat += "-(insetC)-[button]" verticalFormat += "-(insetC)-[button]"
views["button"] = leftButtons![0] views["button"] = leftButtons![0]
...@@ -542,7 +556,6 @@ public class CardView : MaterialPulseView { ...@@ -542,7 +556,6 @@ public class CardView : MaterialPulseView {
if 0 < views.count { if 0 < views.count {
verticalFormat += "-(insetBottom)-|" verticalFormat += "-(insetBottom)-|"
print(verticalFormat)
addConstraints(MaterialLayout.constraint(verticalFormat, options: [], metrics: metrics, views: views)) addConstraints(MaterialLayout.constraint(verticalFormat, options: [], metrics: metrics, views: views))
} }
} }
...@@ -551,9 +564,12 @@ public class CardView : MaterialPulseView { ...@@ -551,9 +564,12 @@ public class CardView : MaterialPulseView {
// :name: prepareImageLayer // :name: prepareImageLayer
// //
internal func prepareImageLayer() { internal func prepareImageLayer() {
imageLayer.masksToBounds = true if nil == imageLayer {
imageLayer.zPosition = 0 imageLayer = CAShapeLayer()
visualLayer.addSublayer(imageLayer) imageLayer!.masksToBounds = true
imageLayer!.zPosition = -1
visualLayer.addSublayer(imageLayer!)
}
} }
// //
......
...@@ -21,7 +21,8 @@ import UIKit ...@@ -21,7 +21,8 @@ import UIKit
public struct MaterialTheme { public struct MaterialTheme {
public struct view {} public struct view {}
public struct pulseView {} public struct pulseView {}
public struct cardView {} public struct basicCardView {}
public struct imageCardView {}
public struct navigationBarView {} public struct navigationBarView {}
public struct textLayer {} public struct textLayer {}
public struct label {} public struct label {}
...@@ -84,8 +85,48 @@ public extension MaterialTheme.pulseView { ...@@ -84,8 +85,48 @@ public extension MaterialTheme.pulseView {
public static var zPosition: CGFloat = 0 public static var zPosition: CGFloat = 0
} }
// cardView // basicCardView
public extension MaterialTheme.cardView { public extension MaterialTheme.basicCardView {
// shadow
public static var shadowDepth: MaterialDepth = .Depth2
public static var shadowColor: UIColor = MaterialColor.black
// shape
public static var contentInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Square2)
public static var titleLabelInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Square2)
public static var detailLabelInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.Square2)
public static var leftButtonsInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.None)
public static var rightButtonsInsetsRef: MaterialInsetsType = MaterialInsetsToValue(.None)
public static var dividerInsetsRef: MaterialInsetsType = (top: 8, left: 0, bottom: 8, right: 0)
// border
public static var borderWidth: MaterialBorder = .None
public static var bordercolor: UIColor = MaterialColor.black
// color
public static var backgroundColor: UIColor = MaterialColor.white
public static var pulseColor: UIColor = MaterialColor.blueGrey.lighten4
public static var pulseColorOpacity: CGFloat = 0.25
// interaction
public static var userInteractionEnabled: Bool = true
// image
public static var contentsRect: CGRect = CGRectMake(0, 0, 1, 1)
public static var contentsCenter: CGRect = CGRectMake(0, 0, 1, 1)
public static var contentsScale: CGFloat = UIScreen.mainScreen().scale
public static var contentsGravity: MaterialGravity = .ResizeAspectFill
// position
public static var zPosition: CGFloat = 0
// divider
public static var divider: Bool = true
public static var dividerColor: UIColor = MaterialColor.blueGrey.lighten5
}
// imageCardView
public extension MaterialTheme.imageCardView {
// shadow // shadow
public static var shadowDepth: MaterialDepth = .Depth2 public static var shadowDepth: MaterialDepth = .Depth2
public static var shadowColor: UIColor = MaterialColor.black public static var shadowColor: UIColor = MaterialColor.black
......
...@@ -196,7 +196,7 @@ public class NavigationBarView : MaterialView { ...@@ -196,7 +196,7 @@ public class NavigationBarView : MaterialView {
:name: init :name: init
*/ */
public convenience init?(titleLabel: UILabel? = nil, detailLabel: UILabel? = nil, leftButtons: Array<UIButton>? = nil, rightButtons: Array<UIButton>? = nil) { public convenience init?(titleLabel: UILabel? = nil, detailLabel: UILabel? = nil, leftButtons: Array<UIButton>? = nil, rightButtons: Array<UIButton>? = nil) {
self.init(frame: CGRectNull) self.init(frame: CGRectMake(MaterialTheme.navigationBarView.x, MaterialTheme.navigationBarView.y, MaterialTheme.navigationBarView.width, MaterialTheme.navigationBarView.height))
prepareProperties(titleLabel, detailLabel: detailLabel, leftButtons: leftButtons, rightButtons: rightButtons) prepareProperties(titleLabel, detailLabel: detailLabel, leftButtons: leftButtons, rightButtons: rightButtons)
} }
......
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