Commit fe5afa24 by Daniel Dahan

master: merged development

parents 994edd5b b65ca0e8
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'MK' s.name = 'MK'
s.version = '1.3.0' s.version = '1.4.0'
s.license = { :type => "AGPLv3+", :file => "LICENSE" } s.license = { :type => "AGPLv3+", :file => "LICENSE" }
s.summary = 'A Material Design Framework In Swift' s.summary = 'A Material Design Framework In Swift'
s.homepage = 'http://materialkit.io' s.homepage = 'http://materialkit.io'
......
...@@ -7,15 +7,11 @@ ...@@ -7,15 +7,11 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
657CD0291B8EE0D3008C0029 /* MaterialView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65B965741B8A60A00055B139 /* MaterialView.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 657CD02A1B8EE0D3008C0029 /* MaterialCard.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9A94D1081B8A3F5100F586A5 /* MaterialCard.swift */; settings = {ATTRIBUTES = (Public, ); }; };
657CD02A1B8EE0D3008C0029 /* MaterialPulseView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9A94D1081B8A3F5100F586A5 /* MaterialPulseView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
657CD02B1B8EE0D3008C0029 /* MaterialViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65B965711B8A578D0055B139 /* MaterialViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
657CD02C1B8EE0D3008C0029 /* SideNavController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65B965861B8BEEC60055B139 /* SideNavController.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 657CD02C1B8EE0D3008C0029 /* SideNavController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65B965861B8BEEC60055B139 /* SideNavController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
657CD02D1B8EE0D3008C0029 /* MaterialButton.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65B9657D1B8A7C330055B139 /* MaterialButton.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 657CD02D1B8EE0D3008C0029 /* MaterialButton.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65B9657D1B8A7C330055B139 /* MaterialButton.swift */; settings = {ATTRIBUTES = (Public, ); }; };
657CD02E1B8EE0D3008C0029 /* AddFabButton.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9638329D1B8EC34D0015F710 /* AddFabButton.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 657CD02E1B8EE0D3008C0029 /* (null) in Headers */ = {isa = PBXBuildFile; settings = {ATTRIBUTES = (Public, ); }; };
657CD02F1B8EE0D3008C0029 /* ImageCard.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9A94D10A1B8A485C00F586A5 /* ImageCard.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 657CD02F1B8EE0D3008C0029 /* ImageCard.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9A94D10A1B8A485C00F586A5 /* ImageCard.swift */; settings = {ATTRIBUTES = (Public, ); }; };
65B965721B8A578D0055B139 /* MaterialViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B965711B8A578D0055B139 /* MaterialViewController.swift */; };
65B965751B8A60A00055B139 /* MaterialView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B965741B8A60A00055B139 /* MaterialView.swift */; };
65B9657E1B8A7C330055B139 /* MaterialButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B9657D1B8A7C330055B139 /* MaterialButton.swift */; }; 65B9657E1B8A7C330055B139 /* MaterialButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B9657D1B8A7C330055B139 /* MaterialButton.swift */; };
65B965871B8BEEC60055B139 /* SideNavController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B965861B8BEEC60055B139 /* SideNavController.swift */; }; 65B965871B8BEEC60055B139 /* SideNavController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B965861B8BEEC60055B139 /* SideNavController.swift */; };
963832421B88DFD80015F710 /* MaterialKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 963832361B88DFD80015F710 /* MaterialKit.framework */; }; 963832421B88DFD80015F710 /* MaterialKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 963832361B88DFD80015F710 /* MaterialKit.framework */; };
...@@ -38,13 +34,16 @@ ...@@ -38,13 +34,16 @@
963832851B89070E0015F710 /* CapturePreview.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9638325F1B88E5BF0015F710 /* CapturePreview.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 963832851B89070E0015F710 /* CapturePreview.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9638325F1B88E5BF0015F710 /* CapturePreview.swift */; settings = {ATTRIBUTES = (Public, ); }; };
963832881B8908180015F710 /* Layout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 963832871B8908180015F710 /* Layout.swift */; }; 963832881B8908180015F710 /* Layout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 963832871B8908180015F710 /* Layout.swift */; };
963832891B89097D0015F710 /* Layout.swift in Headers */ = {isa = PBXBuildFile; fileRef = 963832871B8908180015F710 /* Layout.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 963832891B89097D0015F710 /* Layout.swift in Headers */ = {isa = PBXBuildFile; fileRef = 963832871B8908180015F710 /* Layout.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9638329E1B8EC34D0015F710 /* AddFabButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9638329D1B8EC34D0015F710 /* AddFabButton.swift */; }; 96B57D4E1B90AF7D00DE7BBB /* MaterialTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96B57D4D1B90AF7D00DE7BBB /* MaterialTheme.swift */; };
9A3A3B6A1B8E992F005F16BC /* ImageTextCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A3A3B691B8E992F005F16BC /* ImageTextCard.swift */; };
9A3A3B6E1B8EA7A5005F16BC /* ImageTextButtonCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A3A3B6D1B8EA7A5005F16BC /* ImageTextButtonCard.swift */; };
9A3A3B701B8EB582005F16BC /* ImageRevealCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A3A3B6F1B8EB582005F16BC /* ImageRevealCard.swift */; };
9A94D0F91B895C8C00F586A5 /* Roboto.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9AAC38531B89559900FE6B2D /* Roboto.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 9A94D0F91B895C8C00F586A5 /* Roboto.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9AAC38531B89559900FE6B2D /* Roboto.swift */; settings = {ATTRIBUTES = (Public, ); }; };
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 */; };
9A94D0FD1B895EA500F586A5 /* Roboto-Light.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9AAC38551B8956C500FE6B2D /* Roboto-Light.ttf */; }; 9A94D0FD1B895EA500F586A5 /* Roboto-Light.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9AAC38551B8956C500FE6B2D /* Roboto-Light.ttf */; };
9A94D1091B8A3F5100F586A5 /* MaterialPulseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A94D1081B8A3F5100F586A5 /* MaterialPulseView.swift */; }; 9A94D1091B8A3F5100F586A5 /* MaterialCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A94D1081B8A3F5100F586A5 /* MaterialCard.swift */; };
9A94D10B1B8A485C00F586A5 /* ImageCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A94D10A1B8A485C00F586A5 /* ImageCard.swift */; }; 9A94D10B1B8A485C00F586A5 /* ImageCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A94D10A1B8A485C00F586A5 /* ImageCard.swift */; };
9AAC384D1B89528900FE6B2D /* BasicCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AAC384C1B89528900FE6B2D /* BasicCard.swift */; }; 9AAC384D1B89528900FE6B2D /* BasicCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AAC384C1B89528900FE6B2D /* BasicCard.swift */; };
9AAC38541B89559900FE6B2D /* Roboto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AAC38531B89559900FE6B2D /* Roboto.swift */; }; 9AAC38541B89559900FE6B2D /* Roboto.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AAC38531B89559900FE6B2D /* Roboto.swift */; };
...@@ -62,8 +61,6 @@ ...@@ -62,8 +61,6 @@
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
65B965711B8A578D0055B139 /* MaterialViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialViewController.swift; sourceTree = "<group>"; };
65B965741B8A60A00055B139 /* MaterialView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialView.swift; sourceTree = "<group>"; };
65B9657D1B8A7C330055B139 /* MaterialButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialButton.swift; sourceTree = "<group>"; }; 65B9657D1B8A7C330055B139 /* MaterialButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialButton.swift; sourceTree = "<group>"; };
65B965861B8BEEC60055B139 /* SideNavController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SideNavController.swift; sourceTree = "<group>"; }; 65B965861B8BEEC60055B139 /* SideNavController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SideNavController.swift; sourceTree = "<group>"; };
963832361B88DFD80015F710 /* MaterialKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MaterialKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 963832361B88DFD80015F710 /* MaterialKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MaterialKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
...@@ -81,8 +78,11 @@ ...@@ -81,8 +78,11 @@
963832671B88E5BF0015F710 /* TextStorage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextStorage.swift; sourceTree = "<group>"; }; 963832671B88E5BF0015F710 /* TextStorage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextStorage.swift; sourceTree = "<group>"; };
963832681B88E5BF0015F710 /* TextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = "<group>"; }; 963832681B88E5BF0015F710 /* TextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextView.swift; sourceTree = "<group>"; };
963832871B8908180015F710 /* Layout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Layout.swift; sourceTree = "<group>"; }; 963832871B8908180015F710 /* Layout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Layout.swift; sourceTree = "<group>"; };
9638329D1B8EC34D0015F710 /* AddFabButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddFabButton.swift; sourceTree = "<group>"; }; 96B57D4D1B90AF7D00DE7BBB /* MaterialTheme.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTheme.swift; sourceTree = "<group>"; };
9A94D1081B8A3F5100F586A5 /* MaterialPulseView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialPulseView.swift; sourceTree = "<group>"; }; 9A3A3B691B8E992F005F16BC /* ImageTextCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageTextCard.swift; sourceTree = "<group>"; };
9A3A3B6D1B8EA7A5005F16BC /* ImageTextButtonCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageTextButtonCard.swift; sourceTree = "<group>"; };
9A3A3B6F1B8EB582005F16BC /* ImageRevealCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageRevealCard.swift; sourceTree = "<group>"; };
9A94D1081B8A3F5100F586A5 /* MaterialCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialCard.swift; sourceTree = "<group>"; };
9A94D10A1B8A485C00F586A5 /* ImageCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageCard.swift; sourceTree = "<group>"; }; 9A94D10A1B8A485C00F586A5 /* ImageCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageCard.swift; sourceTree = "<group>"; };
9AAC384C1B89528900FE6B2D /* BasicCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicCard.swift; sourceTree = "<group>"; }; 9AAC384C1B89528900FE6B2D /* BasicCard.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicCard.swift; sourceTree = "<group>"; };
9AAC38531B89559900FE6B2D /* Roboto.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Roboto.swift; sourceTree = "<group>"; }; 9AAC38531B89559900FE6B2D /* Roboto.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Roboto.swift; sourceTree = "<group>"; };
...@@ -113,9 +113,6 @@ ...@@ -113,9 +113,6 @@
65B965731B8A58E60055B139 /* View */ = { 65B965731B8A58E60055B139 /* View */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
65B965741B8A60A00055B139 /* MaterialView.swift */,
9A94D1081B8A3F5100F586A5 /* MaterialPulseView.swift */,
65B965711B8A578D0055B139 /* MaterialViewController.swift */,
); );
name = View; name = View;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -151,6 +148,7 @@ ...@@ -151,6 +148,7 @@
children = ( children = (
963832631B88E5BF0015F710 /* LICENSE */, 963832631B88E5BF0015F710 /* LICENSE */,
9638325C1B88E3420015F710 /* Supporting Files */, 9638325C1B88E3420015F710 /* Supporting Files */,
96B57D4C1B90AF6A00DE7BBB /* Theme */,
9AAC38521B89553800FE6B2D /* Font */, 9AAC38521B89553800FE6B2D /* Font */,
963832861B8907FE0015F710 /* Layout */, 963832861B8907FE0015F710 /* Layout */,
65B965731B8A58E60055B139 /* View */, 65B965731B8A58E60055B139 /* View */,
...@@ -202,7 +200,6 @@ ...@@ -202,7 +200,6 @@
children = ( children = (
65B9657D1B8A7C330055B139 /* MaterialButton.swift */, 65B9657D1B8A7C330055B139 /* MaterialButton.swift */,
963832601B88E5BF0015F710 /* FabButton.swift */, 963832601B88E5BF0015F710 /* FabButton.swift */,
9638329D1B8EC34D0015F710 /* AddFabButton.swift */,
963832611B88E5BF0015F710 /* FlatButton.swift */, 963832611B88E5BF0015F710 /* FlatButton.swift */,
963832651B88E5BF0015F710 /* RaisedButton.swift */, 963832651B88E5BF0015F710 /* RaisedButton.swift */,
); );
...@@ -227,11 +224,23 @@ ...@@ -227,11 +224,23 @@
name = Layout; name = Layout;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
96B57D4C1B90AF6A00DE7BBB /* Theme */ = {
isa = PBXGroup;
children = (
96B57D4D1B90AF7D00DE7BBB /* MaterialTheme.swift */,
);
name = Theme;
sourceTree = "<group>";
};
9AAC384B1B89524E00FE6B2D /* Card */ = { 9AAC384B1B89524E00FE6B2D /* Card */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9A94D1081B8A3F5100F586A5 /* MaterialCard.swift */,
9AAC384C1B89528900FE6B2D /* BasicCard.swift */, 9AAC384C1B89528900FE6B2D /* BasicCard.swift */,
9A94D10A1B8A485C00F586A5 /* ImageCard.swift */, 9A94D10A1B8A485C00F586A5 /* ImageCard.swift */,
9A3A3B691B8E992F005F16BC /* ImageTextCard.swift */,
9A3A3B6D1B8EA7A5005F16BC /* ImageTextButtonCard.swift */,
9A3A3B6F1B8EB582005F16BC /* ImageRevealCard.swift */,
); );
name = Card; name = Card;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -265,12 +274,10 @@ ...@@ -265,12 +274,10 @@
9A94D0F91B895C8C00F586A5 /* Roboto.swift in Headers */, 9A94D0F91B895C8C00F586A5 /* Roboto.swift in Headers */,
963832851B89070E0015F710 /* CapturePreview.swift in Headers */, 963832851B89070E0015F710 /* CapturePreview.swift in Headers */,
963832891B89097D0015F710 /* Layout.swift in Headers */, 963832891B89097D0015F710 /* Layout.swift in Headers */,
657CD0291B8EE0D3008C0029 /* MaterialView.swift in Headers */, 657CD02A1B8EE0D3008C0029 /* MaterialCard.swift in Headers */,
657CD02A1B8EE0D3008C0029 /* MaterialPulseView.swift in Headers */,
657CD02B1B8EE0D3008C0029 /* MaterialViewController.swift in Headers */,
657CD02C1B8EE0D3008C0029 /* SideNavController.swift in Headers */, 657CD02C1B8EE0D3008C0029 /* SideNavController.swift in Headers */,
657CD02D1B8EE0D3008C0029 /* MaterialButton.swift in Headers */, 657CD02D1B8EE0D3008C0029 /* MaterialButton.swift in Headers */,
657CD02E1B8EE0D3008C0029 /* AddFabButton.swift in Headers */, 657CD02E1B8EE0D3008C0029 /* (null) in Headers */,
657CD02F1B8EE0D3008C0029 /* ImageCard.swift in Headers */, 657CD02F1B8EE0D3008C0029 /* ImageCard.swift in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -377,15 +384,16 @@ ...@@ -377,15 +384,16 @@
files = ( files = (
963832691B88E5BF0015F710 /* Capture.swift in Sources */, 963832691B88E5BF0015F710 /* Capture.swift in Sources */,
9A94D10B1B8A485C00F586A5 /* ImageCard.swift in Sources */, 9A94D10B1B8A485C00F586A5 /* ImageCard.swift in Sources */,
96B57D4E1B90AF7D00DE7BBB /* MaterialTheme.swift in Sources */,
9638326B1B88E5BF0015F710 /* FabButton.swift in Sources */, 9638326B1B88E5BF0015F710 /* FabButton.swift in Sources */,
9A94D1091B8A3F5100F586A5 /* MaterialPulseView.swift in Sources */, 9A94D1091B8A3F5100F586A5 /* MaterialCard.swift in Sources */,
9A3A3B701B8EB582005F16BC /* ImageRevealCard.swift in Sources */,
9A3A3B6A1B8E992F005F16BC /* ImageTextCard.swift in Sources */,
65B965871B8BEEC60055B139 /* SideNavController.swift in Sources */, 65B965871B8BEEC60055B139 /* SideNavController.swift in Sources */,
9638326C1B88E5BF0015F710 /* FlatButton.swift in Sources */, 9638326C1B88E5BF0015F710 /* FlatButton.swift in Sources */,
65B965751B8A60A00055B139 /* MaterialView.swift in Sources */,
963832711B88E5BF0015F710 /* Text.swift in Sources */, 963832711B88E5BF0015F710 /* Text.swift in Sources */,
9638326A1B88E5BF0015F710 /* CapturePreview.swift in Sources */, 9638326A1B88E5BF0015F710 /* CapturePreview.swift in Sources */,
9638329E1B8EC34D0015F710 /* AddFabButton.swift in Sources */, 9A3A3B6E1B8EA7A5005F16BC /* ImageTextButtonCard.swift in Sources */,
65B965721B8A578D0055B139 /* MaterialViewController.swift in Sources */,
9AAC38541B89559900FE6B2D /* Roboto.swift in Sources */, 9AAC38541B89559900FE6B2D /* Roboto.swift in Sources */,
65B9657E1B8A7C330055B139 /* MaterialButton.swift in Sources */, 65B9657E1B8A7C330055B139 /* MaterialButton.swift in Sources */,
963832881B8908180015F710 /* Layout.swift in Sources */, 963832881B8908180015F710 /* Layout.swift in Sources */,
......
![MaterialKit](http://materialkit.io/MaterialKitLogo.png) # MaterialKit
# Build Beautiful Software ### Build Beautiful Software
* [CocoaPods (MK)](https://cocoapods.org/?q=MK) * [CocoaPods (MK)](https://cocoapods.org/?q=MK)
### CocoaPods Support ### CocoaPods Support
MaterialKit is now on CocoaPods under the name [MK](https://cocoapods.org/?q=MK). MaterialKit is now on CocoaPods under the name [MK](https://cocoapods.org/?q=MK).
### Floating Action Button
![MaterialKitPreview](http://www.materialkit.io/MaterialKitPreview.gif) Make a call to action with a Floating Action Button.
### Floating Action Button ![MaterialKitPreview](http://www.materialkit.io/fabbuttonpreview.gif)
```swift ```swift
var button: FabButton = FabButton() var button: FabButton = FabButton()
button.setTitle("+", forState: .Normal)
button.titleLabel!.font = UIFont(name: "Arial", size: 32)
view.addSubview(button)
Layout.size(view, child: button, width: 60, height: 60)
``` ```
### Flat Button ### Raised Button
Use a Raised Button to capture attention.
![MaterialKitPreview](http://www.materialkit.io/raisedbuttonpreview.gif)
```swift ```swift
var button: FlatButton = FlatButton() var button: RaisedButton = RaisedButton()
button.setTitle("Raised", forState: .Normal)
view.addSubview(button)
Layout.size(view, child: button, width: 200, height: 60)
``` ```
### Raised Button ### Flat Button
Keep it simple and elegant with a Flat Button.
![MaterialKitPreview](http://www.materialkit.io/flatbuttonpreview.gif)
```swift ```swift
var button: RaisedButton = RaisedButton() var button: RaisedButton = RaisedButton()
button.setTitle("Flat", forState: .Normal)
view.addSubview(button)
Layout.size(view, child: button, width: 200, height: 60)
```
### Basic Card
Easily make cards with fully customizable components.
![MaterialKitPreview](http://www.materialkit.io/basiccardpreview.gif)
```swift
var card: BasicCard = BasicCard()
// add a title
card.titleLabel = UILabel()
card.titleLabel!.text = "Card Title"
// add a body of text
card.detailTextLabel = UILabel()
card.detailTextLabel!.text = "I am a very simple card. I am good at containing small bits of information. I am convenient because I require little markup to use effectively."
// add a divider for buttons
card.divider = UIView()
// add a couple buttons
var cancelButton: FlatButton = FlatButton()
cancelButton.pulseColor = MaterialTheme.blueGrey.darken3
cancelButton.setTitle("Cancel", forState: .Normal)
cancelButton.setTitleColor(MaterialTheme.yellow.darken3, forState: .Normal)
var okButton: FlatButton = FlatButton()
okButton.pulseColor = MaterialTheme.blueGrey.darken3
okButton.setTitle("Okay", forState: .Normal)
okButton.setTitleColor(MaterialTheme.yellow.darken3, forState: .Normal)
card.buttons = [cancelButton, okButton]
view.addSubview(card)
``` ```
### Side Navigation Controller ### Side Navigation Controller
Add a sleek Side Navigation to give your users a wonderful experience.
![MaterialKitPreview](http://www.materialkit.io/sidenavpreview.gif)
```swift ```swift
class AppDelegate: UIResponder, UIApplicationDelegate, SideNavDelegate { func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
var window: UIWindow? sideNav = SideNavController(mainViewController: MainViewController(), leftViewController: LeftViewController(), rightViewController: RightViewController())
var sideNav: SideNavController? sideNav!.delegate = self
private lazy var graph: Graph = Graph() window = UIWindow(frame: UIScreen.mainScreen().bounds)
window!.rootViewController = sideNav
window!.makeKeyAndVisible()
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { return true
sideNav = SideNavController(mainViewController: MainViewController(), leftViewController: LeftViewController(), rightViewController: RightViewController()) }
sideNav!.delegate = self
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window!.rootViewController = sideNav
window!.makeKeyAndVisible()
return true
}
...
``` ```
### License ### License
......
//
// 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 class AddFabButton : FabButton {
/**
:name: lineWidth
*/
public var lineWidth: CGFloat = 2
//
// :name: verticalLine
//
private var verticalLine: UIView!
//
// :name: horizontalLine
//
private var horizontalLine: UIView!
//
// :name: prepareButton
//
public override func prepareButton() {
super.prepareButton()
prepareVerticalLine()
prepareHorizontalLine()
}
//
// :name: prepareVerticalLine
//
private func prepareVerticalLine() {
verticalLine = UIView(frame: CGRectMake(0, 0, lineWidth, CGRectGetHeight(backgroundColorView.frame) / 3))
verticalLine.backgroundColor = .whiteColor()
verticalLine.center = backgroundColorView.center
backgroundColorView.addSubview(verticalLine)
}
//
// :name: prepareHorizontalLine
//
private func prepareHorizontalLine() {
horizontalLine = UIView(frame: CGRectMake(0, 0, CGRectGetWidth(backgroundColorView.frame) / 3, lineWidth))
horizontalLine.backgroundColor = .whiteColor()
horizontalLine.center = backgroundColorView.center
backgroundColorView.addSubview(horizontalLine)
}
}
...@@ -19,88 +19,132 @@ ...@@ -19,88 +19,132 @@
import UIKit import UIKit
import QuartzCore import QuartzCore
public class BasicCard : MaterialPulseView { public class BasicCard : MaterialCard {
public lazy var cancelButton: FlatButton = FlatButton() //
public lazy var otherButton: FlatButton = FlatButton() // :name: layoutConstraints
public lazy var buttonColor: UIColor = UIColor(red: 255.0/255.0, green: 156.0/255.0, blue: 38.0/255.0, alpha: 1.0) //
public lazy var titleLabel: UILabel = UILabel() internal lazy var layoutConstraints: Array<NSLayoutConstraint> = Array<NSLayoutConstraint>()
public lazy var detailTextLabel: UILabel = UILabel()
public lazy var horizontalSeparator: UIView = UIView()
public required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
public required init(frame: CGRect) {
super.init(frame: frame)
}
internal override func initialize() {
setupTitleLabel()
setupDetailTextLabel()
setupHorizontalLineSeparator()
setupButtons()
super.initialize()
}
internal override func constrainSubviews() { //
super.constrainSubviews() // :name: views
addConstraints(Layout.constraint("H:|-(20)-[titleLabel]-(20)-|", options: nil, metrics: nil, views: views)) //
addConstraints(Layout.constraint("H:|-(20)-[detailTextLabel]-(20)-|", options: nil, metrics: nil, views: views)) internal lazy var views: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
addConstraints(Layout.constraint("H:|[horizontalSeparator]|", options: nil, metrics: nil, views: views))
addConstraints(Layout.constraint("H:|-(10)-[cancelButton(80)]-(10)-[otherButton(80)]", options: nil, metrics: nil, views: views)) //
addConstraints(Layout.constraint("V:|-(20)-[titleLabel(22)]-(10)-[detailTextLabel]-(20)-[line(1)]-(10)-[cancelButton]-(10)-|", options: nil, metrics: nil, views: views)) // :name: divider
addConstraints(Layout.constraint("V:|-(20)-[titleLabel(22)]-(10)-[detailTextLabel]-(20)-[line(1)]-(10)-[otherButton]-(10)-|", options: nil, metrics: nil, views: views)) //
public var divider: UIView? {
didSet {
divider!.setTranslatesAutoresizingMaskIntoConstraints(false)
divider!.backgroundColor = MaterialTheme.blueGrey.color
addSubview(divider!)
prepareCard()
}
}
/**
:name: titleLabel
*/
public var titleLabel: UILabel? {
didSet {
titleLabel!.setTranslatesAutoresizingMaskIntoConstraints(false)
titleLabel!.textColor = MaterialTheme.white.color
titleLabel!.font = Roboto.regularWithSize(22.0)
addSubview(titleLabel!)
prepareCard()
}
}
/**
:name: detailTextLabel
*/
public var detailTextLabel: UILabel? {
didSet {
detailTextLabel!.setTranslatesAutoresizingMaskIntoConstraints(false)
detailTextLabel!.textColor = MaterialTheme.white.color
detailTextLabel!.font = Roboto.lightWithSize(16.0)
detailTextLabel!.numberOfLines = 0
detailTextLabel!.lineBreakMode = .ByWordWrapping
addSubview(detailTextLabel!)
prepareCard()
}
} }
private func setupTitleLabel() { /**
titleLabel.setTranslatesAutoresizingMaskIntoConstraints(false) :name: buttons
titleLabel.font = Roboto.regularWithSize(22.0) */
titleLabel.textColor = UIColor.whiteColor() public var buttons: Array<MaterialButton>? {
titleLabel.text = "Card Title" didSet {
addSubview(titleLabel) prepareCard()
views["titleLabel"] = titleLabel }
} }
private func setupDetailTextLabel() { //
detailTextLabel.setTranslatesAutoresizingMaskIntoConstraints(false) // :name: prepareView
detailTextLabel.font = Roboto.lightWithSize(16.0) //
detailTextLabel.textColor = UIColor.whiteColor() internal override func prepareView() {
detailTextLabel.text = "I am a very simple card. I am good at containing small bits of information. I am convenient because I require little markup to use effectively." super.prepareView()
detailTextLabel.numberOfLines = 0 backgroundColor = MaterialTheme.blueGrey.darken1
detailTextLabel.lineBreakMode = NSLineBreakMode.ByWordWrapping }
addSubview(detailTextLabel)
views["detailTextLabel"] = detailTextLabel //
} // :name: prepareCard
//
private func setupHorizontalLineSeparator() { internal override func prepareCard() {
horizontalSeparator.setTranslatesAutoresizingMaskIntoConstraints(false) super.prepareCard()
horizontalSeparator.backgroundColor = UIColor.whiteColor() prepareShadow()
horizontalSeparator.alpha = 0.2
addSubview(horizontalSeparator) // deactivate and clear all constraints
views["horizontalSeparator"] = horizontalSeparator NSLayoutConstraint.deactivateConstraints(layoutConstraints)
} layoutConstraints.removeAll(keepCapacity: false)
private func setupButtons() { // detect all components and create constraints
setupCancelButton() var verticalFormat: String = "V:|"
setupOtherButton()
} // title
if nil != titleLabel {
private func setupCancelButton() { layoutConstraints += Layout.constraint("H:|-(20)-[titleLabel]-(20)-|", options: nil, metrics: nil, views: ["titleLabel": titleLabel!])
cancelButton.setTranslatesAutoresizingMaskIntoConstraints(false) verticalFormat += "-(20)-[titleLabel(22)]"
cancelButton.setTitle("Cancel", forState: .Normal) views["titleLabel"] = titleLabel!
cancelButton.setTitleColor(buttonColor, forState: .Normal) }
cancelButton.pulseColor = buttonColor
addSubview(cancelButton) // details
views["cancelButton"] = cancelButton if nil != detailTextLabel {
} layoutConstraints += Layout.constraint("H:|-(20)-[detailTextLabel]-(20)-|", options: nil, metrics: nil, views: ["detailTextLabel": detailTextLabel!])
verticalFormat += "-(20)-[detailTextLabel]"
private func setupOtherButton() { views["detailTextLabel"] = detailTextLabel!
otherButton.setTranslatesAutoresizingMaskIntoConstraints(false) }
otherButton.setTitle("Confirm", forState: .Normal)
otherButton.setTitleColor(buttonColor, forState: .Normal) if nil != buttons {
otherButton.pulseColor = buttonColor // divider
addSubview(otherButton) if nil != divider {
views["otherButton"] = otherButton layoutConstraints += Layout.constraint("H:|[divider]|", options: nil, metrics: nil, views: ["divider": divider!])
} views["divider"] = divider!
verticalFormat += "-(20)-[divider(1)]"
}
// buttons
var horizontalFormat: String = "H:|"
var buttonViews: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
for var i: Int = 0, l: Int = buttons!.count; i < l; ++i {
let button: MaterialButton = buttons![i]
addSubview(button)
buttonViews["button\(i)"] = button
views["button\(i)"] = button as AnyObject
horizontalFormat += "-(10)-[button\(i)]"
layoutConstraints += Layout.constraint(verticalFormat + "-(10)-[button\(i)]-(10)-|", options: nil, metrics: nil, views: views)
}
layoutConstraints += Layout.constraint(horizontalFormat, options: nil, metrics: nil, views: buttonViews)
} else {
verticalFormat += "-(20)-|"
}
// combine constraints
if 0 < layoutConstraints.count {
layoutConstraints += Layout.constraint(verticalFormat, options: nil, metrics: nil, views: views)
NSLayoutConstraint.activateConstraints(layoutConstraints)
}
}
} }
...@@ -22,11 +22,18 @@ public class FabButton : MaterialButton { ...@@ -22,11 +22,18 @@ public class FabButton : MaterialButton {
// //
// :name: prepareButton // :name: prepareButton
// //
internal override func prepareView() {
super.prepareView()
setTitleColor(MaterialTheme.white.color, forState: .Normal)
backgroundColor = MaterialTheme.red.darken1
}
//
// :name: prepareButton
//
internal override func prepareButton() { internal override func prepareButton() {
super.prepareButton() super.prepareButton()
prepareShadow() prepareShadow()
backgroundColor = .redColor()
pulseColor = .whiteColor()
backgroundColorView.layer.cornerRadius = bounds.width / 2 backgroundColorView.layer.cornerRadius = bounds.width / 2
} }
......
...@@ -20,13 +20,21 @@ import UIKit ...@@ -20,13 +20,21 @@ import UIKit
public class FlatButton : MaterialButton { public class FlatButton : MaterialButton {
// //
// :name: prepareView
//
internal override func prepareView() {
super.prepareView()
setTitleColor(MaterialTheme.indigo.darken1, forState: .Normal)
pulseColor = MaterialTheme.indigo.darken1
backgroundColor = MaterialTheme.clear.color
contentEdgeInsets = UIEdgeInsetsMake(10, 20, 10, 20)
}
//
// :name: prepareButton // :name: prepareButton
// //
internal override func prepareButton() { internal override func prepareButton() {
super.prepareButton() super.prepareButton()
setTitleColor(UIColor.purpleColor(), forState: .Normal)
pulseColor = .purpleColor()
backgroundColor = .clearColor()
backgroundColorView.layer.cornerRadius = 3 backgroundColorView.layer.cornerRadius = 3
} }
...@@ -36,8 +44,8 @@ public class FlatButton : MaterialButton { ...@@ -36,8 +44,8 @@ public class FlatButton : MaterialButton {
internal override func pulseBegan(touches: Set<NSObject>, withEvent event: UIEvent) { internal override func pulseBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
super.pulseBegan(touches, withEvent: event) super.pulseBegan(touches, withEvent: event)
UIView.animateWithDuration(0.3, animations: { UIView.animateWithDuration(0.3, animations: {
self.pulseView!.transform = CGAffineTransformMakeScale(10, 10) self.pulseView!.transform = CGAffineTransformMakeScale(4, 4)
self.transform = CGAffineTransformMakeScale(1.05, 1.1) self.transform = CGAffineTransformMakeScale(1.05, 1.05)
}) })
} }
} }
////
//// 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/>.
////
// //
// Copyright (C) 2015 GraphKit, Inc. <http://graphkit.io> and other GraphKit contributors. //import UIKit
// //
// This program is free software: you can redistribute it and/or modify //public class ImageCard : MaterialPulseView {
// it under the terms of the GNU Affero General Public License as published // public lazy var imageView: UIImageView = UIImageView()
// by the Free Software Foundation, either version 3 of the License, or //
// (at your option) any later version. // public required init(coder aDecoder: NSCoder) {
// // super.init(coder: aDecoder)
// 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 // public required init(frame: CGRect) {
// GNU Affero General Public License for more details. // super.init(frame: frame)
// // }
// 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 // internal override func initialize() {
// in a file called LICENSE. If not, see <http://www.gnu.org/licenses/>. // prepareImageView()
// // super.initialize()
// }
import UIKit //
// internal override func constrainSubviews() {
public class ImageCard : MaterialPulseView { // super.constrainSubviews()
public lazy var imageView: UIImageView = UIImageView() // addConstraints(Layout.constraint("H:|[imageView]|", options: nil, metrics: nil, views: views))
// addConstraints(Layout.constraint("V:|[imageView]|", options: nil, metrics: nil, views: views))
public required init(coder aDecoder: NSCoder) { // }
super.init(coder: aDecoder) //
} // private func prepareImageView() {
// imageView.setTranslatesAutoresizingMaskIntoConstraints(false)
public required init(frame: CGRect) { // imageView.contentMode = .ScaleAspectFill
super.init(frame: frame) // imageView.userInteractionEnabled = false
} // imageView.clipsToBounds = true
// addSubview(imageView)
internal override func initialize() { // views["imageView"] = imageView
setupImageView() // }
super.initialize() //}
}
internal override func constrainSubviews() {
super.constrainSubviews()
addConstraints(Layout.constraint("H:|[imageView]|", options: nil, metrics: nil, views: views))
addConstraints(Layout.constraint("V:|[imageView]|", options: nil, metrics: nil, views: views))
}
private func setupImageView() {
imageView.setTranslatesAutoresizingMaskIntoConstraints(false)
imageView.contentMode = .ScaleAspectFill
imageView.userInteractionEnabled = false
imageView.clipsToBounds = true
addSubview(imageView)
views["imageView"] = imageView
}
}
////
//// RevealCard.swift
//// MaterialKit
////
//// Created by Adam Dahan on 2015-08-26.
//// Copyright (c) 2015 GraphKit Inc. All rights reserved.
////
//
//import UIKit
//
//public class ImageRevealCard : ImageCard {
//
// private lazy var revealView: UIView = UIView()
// private lazy var tapGesture: UITapGestureRecognizer = UITapGestureRecognizer()
// private lazy var metrics: Dictionary <String, AnyObject> = Dictionary <String, AnyObject>()
// private var topLayoutConstraint: NSLayoutConstraint!
// private lazy var hideRevealViewButton: UIButton = UIButton()
//
// public required init(coder aDecoder: NSCoder) {
// super.init(coder: aDecoder)
// }
//
// public required init(frame: CGRect) {
// super.init(frame: frame)
// }
//
// internal override func initialize() {
// prepareTapGestures()
// prepareRevealView()
// prepareHideRevealViewButton()
// super.initialize()
// }
//
// public override func layoutSubviews() {
// super.layoutSubviews()
// revealView.frame = CGRectMake(0, 0, bounds.width, bounds.height)
// hideRevealViewButton.frame = CGRectMake(CGRectGetMaxX(revealView.frame) - 50, 10, 40, 40)
// }
//
// private func prepareTapGestures() {
// tapGesture.addTarget(self, action: "showRevealView")
// imageView.userInteractionEnabled = true
// addGestureRecognizer(tapGesture)
// }
//
// private func prepareRevealView() {
// revealView.backgroundColor = .whiteColor()
// revealView.hidden = true
// imageView.addSubview(revealView)
// }
//
// private func prepareHideRevealViewButton() {
// hideRevealViewButton.setImage(UIImage(named: "ic_clear"), forState: .Normal)
// hideRevealViewButton.tintColor = .whiteColor()
// hideRevealViewButton.addTarget(self, action: "hideRevealView", forControlEvents: UIControlEvents.TouchUpInside)
// revealView.addSubview(hideRevealViewButton)
// }
//
// internal func showRevealView() {
// removeTapGestures()
// revealView.hidden = false
// revealView.frame = CGRectMake(0, bounds.height, bounds.width, bounds.height)
// UIView.animateWithDuration(0.3, animations: { () -> Void in
// var frame = self.revealView.frame
// frame.origin.y -= self.bounds.height
// self.revealView.frame = frame
// })
// }
//
// internal func hideRevealView() {
// UIView.animateWithDuration(0.3, animations: { () -> Void in
// var frame = self.revealView.frame
// frame.origin.y = self.bounds.height
// self.revealView.frame = frame
// }) { (finished) -> Void in
// self.revealView.hidden = true
// self.prepareTapGestures()
// }
// }
//
// private func removeTapGestures() {
// removeGestureRecognizer(tapGesture)
// }
//}
//
//
//
////
//// ImageTextButtonCard.swift
//// MaterialKit
////
//// Created by Adam Dahan on 2015-08-26.
//// Copyright (c) 2015 GraphKit Inc. All rights reserved.
////
//
//import UIKit
//
//public class ImageTextButtonCard : MaterialPulseView {
// public lazy var imageView: UIImageView = UIImageView()
// public lazy var titleLabel: UILabel = UILabel()
// public lazy var descriptionContainerView: UIView = UIView()
// public lazy var descriptionLabel: UILabel = UILabel()
// public lazy var horizontalSeparator: UIView = UIView()
// public lazy var button: FlatButton = FlatButton()
//
// public required init(coder aDecoder: NSCoder) {
// super.init(coder: aDecoder)
// }
//
// public required init(frame: CGRect) {
// super.init(frame: frame)
// }
//
// internal override func initialize() {
// prepareImageView()
// prepareTitleLabel()
// prepareDescriptionContainerView()
// prepareDescriptionLabel()
// prepareHorizontalSeparator()
// prepareButton()
// super.initialize()
// }
//
// internal override func constrainSubviews() {
// super.constrainSubviews()
// addConstraints(Layout.constraint("H:|[imageView]|", options: nil, metrics: nil, views: views))
// imageView.addConstraints(Layout.constraint("H:|-20-[titleLabel]-(20)-|", options: nil, metrics: nil, views: views))
// imageView.addConstraints(Layout.constraint("V:[titleLabel(45)]|", options: nil, metrics: nil, views: views))
// addConstraints(Layout.constraint("H:|[descriptionContainerView]|", options: nil, metrics: nil, views: views))
// descriptionContainerView.addConstraints(Layout.constraint("H:|-20-[descriptionLabel]-(20)-|", options: nil, metrics: nil, views: views))
// addConstraints(Layout.constraint("V:|[imageView][descriptionContainerView(160)]|", options: nil, metrics: nil, views: views))
// descriptionContainerView.addConstraints(Layout.constraint("H:|[horizontalSeparator]|", options: nil, metrics: nil, views: views))
// descriptionContainerView.addConstraints(Layout.constraint("H:|-(10)-[button(70)]", options: nil, metrics: nil, views: views))
// descriptionContainerView.addConstraints(Layout.constraint("V:|-(20)-[descriptionLabel]-(20)-[horizontalSeparator(1)]-(10)-[button(30)]-(10)-|", options: nil, metrics: nil, views: views))
// }
//
// private func prepareImageView() {
// imageView.setTranslatesAutoresizingMaskIntoConstraints(false)
// imageView.contentMode = .ScaleAspectFill
// imageView.userInteractionEnabled = false
// imageView.clipsToBounds = true
// addSubview(imageView)
// views["imageView"] = imageView
// }
//
// private func prepareTitleLabel() {
// titleLabel.setTranslatesAutoresizingMaskIntoConstraints(false)
// titleLabel.font = Roboto.mediumWithSize(18)
// titleLabel.textColor = .whiteColor()
// titleLabel.text = "Card Title"
// titleLabel.layer.shadowOffset = CGSizeMake(1, 1)
// titleLabel.layer.shadowOpacity = 0.4
// titleLabel.layer.shadowRadius = 5.0
// imageView.addSubview(titleLabel)
// views["titleLabel"] = titleLabel
// }
//
// private func prepareDescriptionContainerView() {
// descriptionContainerView.setTranslatesAutoresizingMaskIntoConstraints(false)
// descriptionContainerView.backgroundColor = UIColor.whiteColor()
// addSubview(descriptionContainerView)
// views["descriptionContainerView"] = descriptionContainerView
// }
//
// private func prepareDescriptionLabel() {
// descriptionLabel.setTranslatesAutoresizingMaskIntoConstraints(false)
// descriptionLabel.font = Roboto.lightWithSize(14)
// descriptionLabel.textColor = .darkTextColor()
// descriptionLabel.numberOfLines = 0
// descriptionLabel.lineBreakMode = NSLineBreakMode.ByWordWrapping
// descriptionLabel.text = "I am a very simple card. I am good at containing small bits of information. I am convenient because I require little markup to use effectively."
// descriptionContainerView.addSubview(descriptionLabel)
// views["descriptionLabel"] = descriptionLabel
// }
//
// private func prepareHorizontalSeparator() {
// horizontalSeparator.setTranslatesAutoresizingMaskIntoConstraints(false)
// horizontalSeparator.backgroundColor = UIColor.darkGrayColor()
// horizontalSeparator.alpha = 0.2
// descriptionContainerView.addSubview(horizontalSeparator)
// views["horizontalSeparator"] = horizontalSeparator
// }
//
// private func prepareButton() {
// button.setTranslatesAutoresizingMaskIntoConstraints(false)
// button.setTitle("Cancel", forState: .Normal)
// button.setTitleColor(UIColor(red: 255.0/255.0, green: 156.0/255.0, blue: 38.0/255.0, alpha: 1.0), forState: .Normal)
// button.layer.shadowOpacity = 0
// button.titleLabel!.font = Roboto.lightWithSize(16.0)
// button.pulseColor = UIColor(red: 255.0/255.0, green: 156.0/255.0, blue: 38.0/255.0, alpha: 1.0)
// descriptionContainerView.addSubview(button)
// views["button"] = button
// }
//}
////
//// ImageTextCard.swift
//// MaterialKit
////
//// Created by Adam Dahan on 2015-08-26.
//// Copyright (c) 2015 GraphKit Inc. All rights reserved.
////
//
//import UIKit
//
//public class ImageTextCard : MaterialPulseView {
// public lazy var imageView: UIImageView = UIImageView()
// public lazy var titleLabel: UILabel = UILabel()
// public lazy var descriptionContainerView: UIView = UIView()
// public lazy var descriptionLabel: UILabel = UILabel()
// public lazy var horizontalSeparator: UIView = UIView()
// public lazy var ctaButton: FlatButton = FlatButton()
// public lazy var showsCTA: Bool = false
//
// public required init(coder aDecoder: NSCoder) {
// super.init(coder: aDecoder)
// }
//
// public required init(frame: CGRect) {
// super.init(frame: frame)
// }
//
// internal override func initialize() {
// prepareImageView()
// prepareTitleLabel()
// prepareDescriptionContainerView()
// prepareDescriptionLabel()
// if showsCTA {
// prepareHorizontalSeparator()
// prepareCTAButton()
// }
// super.initialize()
// }
//
// internal override func constrainSubviews() {
// super.constrainSubviews()
// addConstraints(Layout.constraint("H:|[imageView]|", options: nil, metrics: nil, views: views))
// imageView.addConstraints(Layout.constraint("H:|-20-[titleLabel]-(20)-|", options: nil, metrics: nil, views: views))
// imageView.addConstraints(Layout.constraint("V:[titleLabel(45)]|", options: nil, metrics: nil, views: views))
// addConstraints(Layout.constraint("H:|[descriptionContainerView]|", options: nil, metrics: nil, views: views))
// descriptionContainerView.addConstraints(Layout.constraint("H:|-20-[descriptionLabel]-(20)-|", options: nil, metrics: nil, views: views))
// descriptionContainerView.addConstraints(Layout.constraint("V:|-(20)-[descriptionLabel]-(20)-|", options: nil, metrics: nil, views: views))
// addConstraints(Layout.constraint("V:|[imageView][descriptionContainerView(120)]|", options: nil, metrics: nil, views: views))
// if showsCTA {
// descriptionContainerView.addConstraints(Layout.constraint("H:|[horizontalSeparator]|", options: nil, metrics: nil, views: views))
// descriptionContainerView.addConstraints(Layout.constraint("V:|-(20)-[descriptionLabel]-(20)-[horizontalSeparator(1)]-(20)-|", options: nil, metrics: nil, views: views))
// }
// }
//
// private func prepareImageView() {
// imageView.setTranslatesAutoresizingMaskIntoConstraints(false)
// imageView.contentMode = .ScaleAspectFill
// imageView.userInteractionEnabled = false
// imageView.clipsToBounds = true
// addSubview(imageView)
// views["imageView"] = imageView
// }
//
// private func prepareTitleLabel() {
// titleLabel.setTranslatesAutoresizingMaskIntoConstraints(false)
// titleLabel.font = Roboto.mediumWithSize(18)
// titleLabel.textColor = .whiteColor()
// titleLabel.text = "Card Title"
// titleLabel.layer.shadowOffset = CGSizeMake(1, 1)
// titleLabel.layer.shadowOpacity = 0.4
// titleLabel.layer.shadowRadius = 5.0
// imageView.addSubview(titleLabel)
// views["titleLabel"] = titleLabel
// }
//
// private func prepareDescriptionContainerView() {
// descriptionContainerView.setTranslatesAutoresizingMaskIntoConstraints(false)
// descriptionContainerView.backgroundColor = UIColor.whiteColor()
// addSubview(descriptionContainerView)
// views["descriptionContainerView"] = descriptionContainerView
// }
//
// private func prepareDescriptionLabel() {
// descriptionLabel.setTranslatesAutoresizingMaskIntoConstraints(false)
// descriptionLabel.font = Roboto.lightWithSize(14)
// descriptionLabel.textColor = .darkTextColor()
// descriptionLabel.numberOfLines = 0
// descriptionLabel.lineBreakMode = NSLineBreakMode.ByWordWrapping
// descriptionLabel.text = "I am a very simple card. I am good at containing small bits of information. I am convenient because I require little markup to use effectively."
// descriptionContainerView.addSubview(descriptionLabel)
// views["descriptionLabel"] = descriptionLabel
// }
//
// private func prepareHorizontalSeparator() {
// horizontalSeparator.setTranslatesAutoresizingMaskIntoConstraints(false)
// horizontalSeparator.backgroundColor = UIColor.whiteColor()
// horizontalSeparator.alpha = 0.2
// descriptionContainerView.addSubview(horizontalSeparator)
// views["horizontalSeparator"] = horizontalSeparator
// }
//
// private func prepareCTAButton() {
//
// }
//}
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.3.0</string> <string>1.4.0</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -46,6 +46,24 @@ public struct Layout { ...@@ -46,6 +46,24 @@ public struct Layout {
} }
/** /**
:name: expandToParentSize
*/
public static func expandToParentSize(parent: UIView, child: UIView) {
let views: Dictionary<String, AnyObject> = ["child" : child]
parent.addConstraints(constraint("H:|[child]|", options: nil, metrics: nil, views: views))
parent.addConstraints(constraint("V:|[child]|", options: nil, metrics: nil, views: views))
}
/**
:name: expandToParentSizeWithPad
*/
public static func expandToParentSizeWithPad(parent: UIView, child: UIView, left: CGFloat, bottom: CGFloat, right: CGFloat, top: CGFloat) {
let views: Dictionary<String, AnyObject> = ["child" : child]
parent.addConstraints(constraint("H:|-(left)-[child]-(right)-|", options: nil, metrics: ["left": left, "right": right], views: views))
parent.addConstraints(constraint("V:|-(top)-[child]-(bottom)-|", options: nil, metrics: ["bottom": bottom, "top": top], views: views))
}
/**
:name: alignFromTopLeft :name: alignFromTopLeft
*/ */
public static func alignFromTopLeft(parent: UIView, child: UIView, top: CGFloat, left: CGFloat) { public static func alignFromTopLeft(parent: UIView, child: UIView, top: CGFloat, left: CGFloat) {
...@@ -84,11 +102,23 @@ public struct Layout { ...@@ -84,11 +102,23 @@ public struct Layout {
parent.addConstraints(constraint("H:[child]-(right)-|", options: nil, metrics: metrics, views: views)) parent.addConstraints(constraint("H:[child]-(right)-|", options: nil, metrics: metrics, views: views))
parent.addConstraints(constraint("V:[child]-(bottom)-|", options: nil, metrics: metrics, views: views)) parent.addConstraints(constraint("V:[child]-(bottom)-|", options: nil, metrics: metrics, views: views))
} }
/**
:name: alignAllSides
*/
public static func alignAllSides(parent: UIView, child: UIView) {
let views: Dictionary<String, AnyObject> = ["child" : child]
parent.addConstraints(constraint("H:|[child]|", options: nil, metrics: nil, views: views))
parent.addConstraints(constraint("V:|[child]|", options: nil, metrics: nil, views: views))
}
/** /**
:name: constraint :name: constraint
*/ */
public static func constraint(format: String, options: NSLayoutFormatOptions, metrics: Dictionary<String, AnyObject>?, views: Dictionary<String, AnyObject>) -> Array<NSLayoutConstraint> { public static func constraint(format: String, options: NSLayoutFormatOptions, metrics: Dictionary<String, AnyObject>?, views: Dictionary<String, AnyObject>) -> Array<NSLayoutConstraint> {
for (_, v) in views {
v.setTranslatesAutoresizingMaskIntoConstraints(false)
}
return NSLayoutConstraint.constraintsWithVisualFormat( return NSLayoutConstraint.constraintsWithVisualFormat(
format, format,
options: options, options: options,
......
...@@ -33,15 +33,18 @@ public class MaterialButton : UIButton { ...@@ -33,15 +33,18 @@ public class MaterialButton : UIButton {
:name: backgroundColor :name: backgroundColor
*/ */
public override var backgroundColor: UIColor? { public override var backgroundColor: UIColor? {
didSet { get {
backgroundColorView.backgroundColor = backgroundColor return backgroundColorView.backgroundColor
}
set(value) {
backgroundColorView.backgroundColor = value
} }
} }
/** /**
:name: pulseColor :name: pulseColor
*/ */
public var pulseColor: UIColor? public var pulseColor: UIColor? = MaterialTheme.white.color
/** /**
:name: init :name: init
...@@ -98,26 +101,38 @@ public class MaterialButton : UIButton { ...@@ -98,26 +101,38 @@ public class MaterialButton : UIButton {
final public override func drawRect(rect: CGRect) { final public override func drawRect(rect: CGRect) {
prepareContext(rect) prepareContext(rect)
prepareButton() prepareButton()
}
//
// :name: prepareView
//
internal func prepareView() {
setTranslatesAutoresizingMaskIntoConstraints(false)
prepareBackgroundColorView() prepareBackgroundColorView()
} }
// //
// :name: prepareButton // :name: prepareButton
// //
internal func prepareButton() { internal func prepareButton() {}
backgroundColorView.frame = bounds
//
// :name: prepareShadow
//
internal func prepareShadow() {
layer.shadowColor = MaterialTheme.black.color.CGColor
layer.shadowOffset = CGSizeMake(0.5, 0.5)
layer.shadowOpacity = 0.5
layer.shadowRadius = 5
} }
// //
// :name: pulseBegan // :name: pulseBegan
// //
internal func pulseBegan(touches: Set<NSObject>, withEvent event: UIEvent) { internal func pulseBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
let touch = touches.first as! UITouch pulseView = UIView(frame: CGRectMake(0, 0, bounds.height, bounds.height))
let touchLocation = touch.locationInView(self)
pulseView = UIView()
pulseView!.frame = CGRectMake(0, 0, bounds.height, bounds.height)
pulseView!.layer.cornerRadius = bounds.height / 2 pulseView!.layer.cornerRadius = bounds.height / 2
pulseView!.center = touchLocation pulseView!.center = (touches.first as! UITouch).locationInView(self)
pulseView!.backgroundColor = pulseColor?.colorWithAlphaComponent(0.5) pulseView!.backgroundColor = pulseColor?.colorWithAlphaComponent(0.5)
backgroundColorView.addSubview(pulseView!) backgroundColorView.addSubview(pulseView!)
} }
...@@ -137,13 +152,15 @@ public class MaterialButton : UIButton { ...@@ -137,13 +152,15 @@ public class MaterialButton : UIButton {
} }
// //
// :name: prepareShadow // :name: prepareContext
// //
internal func prepareShadow() { private func prepareContext(rect: CGRect) {
layer.shadowOffset = CGSizeMake(1, 1) let context = UIGraphicsGetCurrentContext()
layer.shadowColor = UIColor.blackColor().CGColor CGContextSaveGState(context);
layer.shadowOpacity = 0.5 CGContextAddEllipseInRect(context, rect)
layer.shadowRadius = 5 CGContextSetFillColorWithColor(context, MaterialTheme.clear.color.CGColor)
CGContextFillPath(context)
CGContextRestoreGState(context);
} }
// //
...@@ -152,29 +169,12 @@ public class MaterialButton : UIButton { ...@@ -152,29 +169,12 @@ public class MaterialButton : UIButton {
// We need this view so we can use the masksToBounds // We need this view so we can use the masksToBounds
// so the pulse doesn't animate off the button // so the pulse doesn't animate off the button
private func prepareBackgroundColorView() { private func prepareBackgroundColorView() {
backgroundColorView.setTranslatesAutoresizingMaskIntoConstraints(false)
backgroundColorView.layer.masksToBounds = true backgroundColorView.layer.masksToBounds = true
backgroundColorView.clipsToBounds = true backgroundColorView.clipsToBounds = true
backgroundColorView.userInteractionEnabled = false backgroundColorView.userInteractionEnabled = false
insertSubview(backgroundColorView, atIndex: 0) insertSubview(backgroundColorView, atIndex: 0)
} Layout.expandToParentSize(self, child: backgroundColorView)
//
// :name: prepareView
//
private func prepareView() {
setTranslatesAutoresizingMaskIntoConstraints(false)
}
//
// :name: prepareContext
//
private func prepareContext(rect: CGRect) {
let context = UIGraphicsGetCurrentContext()
CGContextSaveGState(context);
CGContextAddEllipseInRect(context, rect)
CGContextSetFillColorWithColor(context, UIColor.clearColor().CGColor)
CGContextFillPath(context)
CGContextRestoreGState(context);
} }
// //
......
//
// 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 class MaterialCard : UIView {
//
// :name: backgroundColorView
//
internal lazy var backgroundColorView: UIView = UIView()
//
// :name: pulseView
//
internal var pulseView: UIView?
/**
:name: backgroundColor
*/
public override var backgroundColor: UIColor? {
get {
return backgroundColorView.backgroundColor
}
set(value) {
backgroundColorView.backgroundColor = value
}
}
/**
:name: pulseColor
*/
public var pulseColor: UIColor = MaterialTheme.white.color
/**
:name: init
*/
public required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
prepareView()
}
/**
:name: init
*/
public required override init(frame: CGRect) {
super.init(frame: frame)
prepareView()
}
/**
:name: init
*/
public convenience init() {
self.init(frame: CGRectZero)
}
/**
:name: touchesBegan
*/
public override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
super.touchesBegan(touches, withEvent: event)
pulseBegan(touches, withEvent: event)
}
/**
:name: touchesEnded
*/
public override func touchesEnded(touches: Set<NSObject>, withEvent event: UIEvent) {
super.touchesEnded(touches, withEvent: event)
shrink()
pulseEnded(touches, withEvent: event)
}
/**
:name: touchesCancelled
*/
public override func touchesCancelled(touches: Set<NSObject>!, withEvent event: UIEvent!) {
super.touchesCancelled(touches, withEvent: event)
shrink()
pulseEnded(touches, withEvent: event)
}
//
// :name: prepareView
//
internal func prepareView() {
setTranslatesAutoresizingMaskIntoConstraints(false)
prepareBackgroundColorView()
prepareCard()
}
//
// :name: prepareCard
//
internal func prepareCard() {}
//
// :name: prepareShadow
//
internal func prepareShadow() {
layer.shadowColor = MaterialTheme.black.color.CGColor
layer.shadowOffset = CGSizeMake(0.5, 0.5)
layer.shadowOpacity = 0.5
layer.shadowRadius = 5
layer.cornerRadius = 2
}
//
// :name: layoutSubviews
//
public override func layoutSubviews() {
super.layoutSubviews()
layer.shadowPath = UIBezierPath(rect: bounds).CGPath
}
//
// :name: pulseBegan
//
internal func pulseBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
let width: CGFloat = bounds.size.width / 3
pulseView = UIView(frame: CGRectMake(0, 0, width, width))
pulseView!.layer.cornerRadius = width / 2
pulseView!.center = (touches.first as! UITouch).locationInView(self)
pulseView!.backgroundColor = pulseColor.colorWithAlphaComponent(0.5)
backgroundColorView.addSubview(pulseView!)
UIView.animateWithDuration(0.3, animations: {
self.pulseView!.transform = CGAffineTransformMakeScale(3, 3)
self.transform = CGAffineTransformMakeScale(1.05, 1.05)
}, completion: nil)
}
//
// :name: pulseEnded
//
internal func pulseEnded(touches: Set<NSObject>, withEvent event: UIEvent) {
UIView.animateWithDuration(0.3,
animations: { _ in
self.pulseView?.alpha = 0
}
) { _ in
self.pulseView?.removeFromSuperview()
self.pulseView = nil
}
}
//
// :name: prepareBackgroundColorView
//
// We need this view so we can use the masksToBounds
// so the pulse doesn't animate off the button
private func prepareBackgroundColorView() {
backgroundColorView.setTranslatesAutoresizingMaskIntoConstraints(false)
backgroundColorView.layer.cornerRadius = 2
backgroundColorView.layer.masksToBounds = true
backgroundColorView.clipsToBounds = true
backgroundColorView.userInteractionEnabled = false
insertSubview(backgroundColorView, atIndex: 0)
Layout.expandToParentSize(self, child: backgroundColorView)
}
//
// :name: shrink
//
private func shrink() {
UIView.animateWithDuration(0.3,
delay: 0,
usingSpringWithDamping: 0.2,
initialSpringVelocity: 10,
options: nil,
animations: {
self.transform = CGAffineTransformIdentity
},
completion: nil
)
}
}
//
// 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 class MaterialPulseView : MaterialView {
internal lazy var views: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
public var backgroundColorView: UIView?
public var pulseView: UIView?
public var color: UIColor?
public var pulseColor: UIColor?
public required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
initialize()
}
public required override init(frame: CGRect) {
super.init(frame: frame)
initialize()
}
public override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
super.touchesBegan(touches, withEvent: event)
pulseTouches(touches)
}
public override func touchesEnded(touches: Set<NSObject>, withEvent event: UIEvent) {
super.touchesEnded(touches, withEvent: event)
shrink()
removePulse()
}
public override func touchesCancelled(touches: Set<NSObject>!, withEvent event: UIEvent!) {
super.touchesCancelled(touches, withEvent: event)
shrink()
removePulse()
}
internal func initialize() {
setupSelf()
setupLayer()
setupBackgroundColorView()
constrainSubviews()
}
internal func constrainSubviews() {
addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("H:|[backgroundColorView]|", options: nil, metrics: nil, views: views))
addConstraints(NSLayoutConstraint.constraintsWithVisualFormat("V:|[backgroundColorView]|", options: nil, metrics: nil, views: views))
}
private func setupSelf() {
color = UIColor.clearColor()
pulseColor = UIColor.whiteColor()
setTranslatesAutoresizingMaskIntoConstraints(false)
backgroundColor = UIColor(red: 66.0/255.0, green: 91.0/255.0, blue: 103.0/255.0, alpha: 1.0)
}
private func setupLayer() {
layer.shadowColor = UIColor.blackColor().CGColor
layer.shadowOffset = CGSizeMake(0.5, 0.5)
layer.shadowRadius = 5.0
layer.shadowOpacity = 0.4
layer.cornerRadius = 2.0
}
// We need this view so we can use the masksToBounds
// so the pulse doesn't animate off the button
private func setupBackgroundColorView() {
backgroundColorView = UIView()
backgroundColorView?.userInteractionEnabled = false
backgroundColorView!.setTranslatesAutoresizingMaskIntoConstraints(false)
backgroundColorView!.layer.cornerRadius = 2.0
backgroundColorView!.backgroundColor = color
backgroundColorView!.layer.masksToBounds = true
addSubview(backgroundColorView!)
views["backgroundColorView"] = backgroundColorView
}
private func pulseTouches(touches: NSSet) {
let touch = touches.allObjects.last as! UITouch
let touchLocation = touch.locationInView(self)
pulseView = UIView()
pulseView?.setTranslatesAutoresizingMaskIntoConstraints(false)
var width = bounds.size.width / 3.0
pulseView!.frame = CGRectMake(0, 0, width, width)
pulseView!.layer.cornerRadius = width / 2.0
pulseView!.center = touchLocation
pulseView!.backgroundColor = pulseColor!.colorWithAlphaComponent(0.1)
backgroundColorView!.addSubview(pulseView!)
UIView.animateWithDuration(0.3, animations: {
self.pulseView!.transform = CGAffineTransformMakeScale(3, 3)
self.transform = CGAffineTransformMakeScale(1.05, 1.05)
}, completion: nil)
}
private func shrink() {
UIView.animateWithDuration(0.3, delay: 0.0, usingSpringWithDamping: 0.2, initialSpringVelocity: 10, options: nil, animations: {
self.transform = CGAffineTransformIdentity
}, completion: nil)
}
private func removePulse() {
UIView.animateWithDuration(0.3, animations: { () -> Void in
self.pulseView?.alpha = 0.0
}) { (finished) -> Void in
self.pulseView?.removeFromSuperview()
self.pulseView = nil
}
}
}
//
// 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 struct MaterialTheme {
// clear
public struct clear {
public static let color: UIColor = white.color.colorWithAlphaComponent(0)
}
// white
public struct white {
public static let color: UIColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 1)
}
// black
public struct black {
public static let color: UIColor = UIColor(red: 0/255, green: 0/255, blue: 0/255, alpha: 1)
}
// red
public struct red {
public static let lighten5: UIColor = UIColor(red: 255/255, green: 235/255, blue: 238/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 225/255, green: 205/255, blue: 210/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 239/255, green: 154/255, blue: 254/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 229/255, green: 115/255, blue: 115/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 229/255, green: 83/255, blue: 80/255, alpha: 1)
public static let color: UIColor = UIColor(red: 244/255, green: 67/255, blue: 54/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 229/255, green: 57/255, blue: 53/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 211/255, green: 47/255, blue: 47/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 198/255, green: 40/255, blue: 40/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 183/255, green: 28/255, blue: 28/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 255/255, green: 138/255, blue: 128/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 255/255, green: 82/255, blue: 82/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 255/255, green: 23/255, blue: 68/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 213/255, green: 0/255, blue: 0/255, alpha: 1)
}
// pink
public struct pink {
public static let lighten5: UIColor = UIColor(red: 252/255, green: 228/255, blue: 236/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 248/255, green: 107/255, blue: 208/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 244/255, green: 143/255, blue: 177/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 240/255, green: 98/255, blue: 146/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 236/255, green: 64/255, blue: 122/255, alpha: 1)
public static let color: UIColor = UIColor(red: 233/255, green: 30/255, blue: 99/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 216/255, green: 27/255, blue: 96/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 194/255, green: 24/255, blue: 191/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 173/255, green: 20/255, blue: 87/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 136/255, green: 14/255, blue: 79/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 255/255, green: 128/255, blue: 171/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 255/255, green: 64/255, blue: 129/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 245/255, green: 0/255, blue: 87/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 197/255, green: 17/255, blue: 98/255, alpha: 1)
}
// purple
public struct purple {
public static let lighten5: UIColor = UIColor(red: 243/255, green: 229/255, blue: 245/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 225/255, green: 190/255, blue: 231/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 206/255, green: 147/255, blue: 216/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 186/255, green: 104/255, blue: 200/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 171/255, green: 71/255, blue: 188/255, alpha: 1)
public static let color: UIColor = UIColor(red: 156/255, green: 39/255, blue: 176/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 142/255, green: 36/255, blue: 170/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 123/255, green: 31/255, blue: 162/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 106/255, green: 27/255, blue: 154/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 74/255, green: 20/255, blue: 140/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 234/255, green: 128/255, blue: 252/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 224/255, green: 64/255, blue: 251/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 213/255, green: 0/255, blue: 249/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 170/255, green: 0/255, blue: 255/255, alpha: 1)
}
// deepPurple
public struct deepPurple {
public static let lighten5: UIColor = UIColor(red: 237/255, green: 231/255, blue: 246/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 209/255, green: 196/255, blue: 233/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 179/255, green: 157/255, blue: 219/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 149/255, green: 117/255, blue: 205/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 126/255, green: 87/255, blue: 194/255, alpha: 1)
public static let color: UIColor = UIColor(red: 103/255, green: 58/255, blue: 183/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 94/255, green: 53/255, blue: 177/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 81/255, green: 45/255, blue: 168/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 69/255, green: 39/255, blue: 160/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 49/255, green: 27/255, blue: 146/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 179/255, green: 136/255, blue: 255/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 124/255, green: 77/255, blue: 255/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 101/255, green: 31/255, blue: 255/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 98/255, green: 0/255, blue: 234/255, alpha: 1)
}
// indigo
public struct indigo {
public static let lighten5: UIColor = UIColor(red: 232/255, green: 234/255, blue: 246/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 197/255, green: 202/255, blue: 233/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 159/255, green: 168/255, blue: 218/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 121/255, green: 134/255, blue: 203/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 92/255, green: 107/255, blue: 192/255, alpha: 1)
public static let color: UIColor = UIColor(red: 63/255, green: 81/255, blue: 181/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 57/255, green: 73/255, blue: 171/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 48/255, green: 63/255, blue: 159/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 40/255, green: 53/255, blue: 147/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 26/255, green: 35/255, blue: 126/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 140/255, green: 158/255, blue: 255/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 83/255, green: 109/255, blue: 254/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 61/255, green: 90/255, blue: 254/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 48/255, green: 79/255, blue: 254/255, alpha: 1)
}
// blue
public struct blue {
public static let lighten5: UIColor = UIColor(red: 227/255, green: 242/255, blue: 253/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 187/255, green: 222/255, blue: 251/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 144/255, green: 202/255, blue: 249/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 100/255, green: 181/255, blue: 246/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 66/255, green: 165/255, blue: 245/255, alpha: 1)
public static let color: UIColor = UIColor(red: 33/255, green: 150/255, blue: 243/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 30/255, green: 136/255, blue: 229/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 25/255, green: 118/255, blue: 210/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 21/255, green: 101/255, blue: 192/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 13/255, green: 71/255, blue: 161/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 130/255, green: 177/255, blue: 255/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 68/255, green: 138/255, blue: 255/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 41/255, green: 121/255, blue: 255/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 41/255, green: 98/255, blue: 255/255, alpha: 1)
}
// light blue
public struct lightBlue {
public static let lighten5: UIColor = UIColor(red: 225/255, green: 245/255, blue: 254/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 179/255, green: 229/255, blue: 252/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 129/255, green: 212/255, blue: 250/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 79/255, green: 195/255, blue: 247/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 41/255, green: 182/255, blue: 246/255, alpha: 1)
public static let color: UIColor = UIColor(red: 3/255, green: 169/255, blue: 244/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 3/255, green: 155/255, blue: 229/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 2/255, green: 136/255, blue: 209/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 2/255, green: 119/255, blue: 189/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 1/255, green: 87/255, blue: 155/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 128/255, green: 216/255, blue: 255/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 64/255, green: 196/255, blue: 255/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 0/255, green: 176/255, blue: 255/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 0/255, green: 145/255, blue: 234/255, alpha: 1)
}
// cyan
public struct cyab {
public static let lighten5: UIColor = UIColor(red: 224/255, green: 247/255, blue: 250/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 1178/255, green: 235/255, blue: 242/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 128/255, green: 222/255, blue: 2343/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 77/255, green: 208/255, blue: 225/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 38/255, green: 198/255, blue: 218/255, alpha: 1)
public static let color: UIColor = UIColor(red: 0/255, green: 188/255, blue: 212/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 0/255, green: 172/255, blue: 193/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 0/255, green: 151/255, blue: 167/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 0/255, green: 131/255, blue: 143/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 0/255, green: 96/255, blue: 100/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 132/255, green: 255/255, blue: 255/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 24/255, green: 255/255, blue: 255/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 0/255, green: 229/255, blue: 255/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 0/255, green: 184/255, blue: 212/255, alpha: 1)
}
// teal
public struct teal {
public static let lighten5: UIColor = UIColor(red: 224/255, green: 242/255, blue: 241/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 178/255, green: 223/255, blue: 219/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 128/255, green: 203/255, blue: 196/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 77/255, green: 182/255, blue: 172/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 38/255, green: 166/255, blue: 154/255, alpha: 1)
public static let color: UIColor = UIColor(red: 0/255, green: 150/255, blue: 136/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 0/255, green: 137/255, blue: 123/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 0/255, green: 121/255, blue: 107/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 0/255, green: 105/255, blue: 92/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 0/255, green: 77/255, blue: 64/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 167/255, green: 255/255, blue: 235/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 100/255, green: 255/255, blue: 218/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 29/255, green: 133/255, blue: 182/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 0/255, green: 191/255, blue: 165/255, alpha: 1)
}
// green
public struct green {
public static let lighten5: UIColor = UIColor(red: 232/255, green: 245/255, blue: 233/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 200/255, green: 230/255, blue: 201/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 165/255, green: 214/255, blue: 167/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 129/255, green: 199/255, blue: 132/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 102/255, green: 187/255, blue: 106/255, alpha: 1)
public static let color: UIColor = UIColor(red: 76/255, green: 175/255, blue: 80/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 67/255, green: 160/255, blue: 71/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 56/255, green: 142/255, blue: 60/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 46/255, green: 125/255, blue: 50/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 27/255, green: 94/255, blue: 32/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 185/255, green: 246/255, blue: 202/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 105/255, green: 240/255, blue: 174/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 0/255, green: 230/255, blue: 118/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 0/255, green: 200/255, blue: 83/255, alpha: 1)
}
// light green
public struct lightGreen {
public static let lighten5: UIColor = UIColor(red: 241/255, green: 248/255, blue: 233/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 220/255, green: 237/255, blue: 200/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 197/255, green: 225/255, blue: 165/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 174/255, green: 213/255, blue: 129/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 156/255, green: 204/255, blue: 101/255, alpha: 1)
public static let color: UIColor = UIColor(red: 139/255, green: 195/255, blue: 74/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 124/255, green: 179/255, blue: 66/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 104/255, green: 159/255, blue: 56/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 85/255, green: 139/255, blue: 47/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 51/255, green: 105/255, blue: 30/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 204/255, green: 255/255, blue: 144/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 178/255, green: 255/255, blue: 89/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 118/255, green: 255/255, blue: 3/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 100/255, green: 221/255, blue: 23/255, alpha: 1)
}
// lime
public struct lime {
public static let lighten5: UIColor = UIColor(red: 249/255, green: 251/255, blue: 231/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 240/255, green: 244/255, blue: 195/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 230/255, green: 238/255, blue: 156/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 220/255, green: 231/255, blue: 117/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 212/255, green: 225/255, blue: 87/255, alpha: 1)
public static let color: UIColor = UIColor(red: 205/255, green: 220/255, blue: 57/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 192/255, green: 202/255, blue: 51/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 175/255, green: 180/255, blue: 43/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 158/255, green: 157/255, blue: 36/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 130/255, green: 119/255, blue: 23/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 244/255, green: 255/255, blue: 129/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 238/255, green: 255/255, blue: 65/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 198/255, green: 255/255, blue: 0/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 174/255, green: 234/255, blue: 0/255, alpha: 1)
}
// yellow
public struct yellow {
public static let lighten5: UIColor = UIColor(red: 255/255, green: 253/255, blue: 231/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 255/255, green: 249/255, blue: 196/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 255/255, green: 245/255, blue: 157/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 255/255, green: 241/255, blue: 118/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 255/255, green: 238/255, blue: 88/255, alpha: 1)
public static let color: UIColor = UIColor(red: 255/255, green: 235/255, blue: 59/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 253/255, green: 216/255, blue: 53/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 251/255, green: 192/255, blue: 45/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 249/255, green: 168/255, blue: 37/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 245/255, green: 127/255, blue: 23/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 255/255, green: 255/255, blue: 141/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 255/255, green: 255/255, blue: 0/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 255/255, green: 234/255, blue: 0/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 255/255, green: 214/255, blue: 0/255, alpha: 1)
}
// amber
public struct amber {
public static let lighten5: UIColor = UIColor(red: 232/255, green: 234/255, blue: 246/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 197/255, green: 202/255, blue: 233/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 159/255, green: 168/255, blue: 218/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 121/255, green: 134/255, blue: 203/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 92/255, green: 107/255, blue: 192/255, alpha: 1)
public static let color: UIColor = UIColor(red: 63/255, green: 81/255, blue: 181/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 57/255, green: 73/255, blue: 171/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 48/255, green: 63/255, blue: 159/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 40/255, green: 53/255, blue: 147/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 26/255, green: 35/255, blue: 126/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 140/255, green: 158/255, blue: 255/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 83/255, green: 109/255, blue: 254/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 61/255, green: 90/255, blue: 254/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 48/255, green: 79/255, blue: 254/255, alpha: 1)
}
// orange
public struct orange {
public static let lighten5: UIColor = UIColor(red: 232/255, green: 234/255, blue: 246/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 197/255, green: 202/255, blue: 233/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 159/255, green: 168/255, blue: 218/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 121/255, green: 134/255, blue: 203/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 92/255, green: 107/255, blue: 192/255, alpha: 1)
public static let color: UIColor = UIColor(red: 63/255, green: 81/255, blue: 181/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 57/255, green: 73/255, blue: 171/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 48/255, green: 63/255, blue: 159/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 40/255, green: 53/255, blue: 147/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 26/255, green: 35/255, blue: 126/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 140/255, green: 158/255, blue: 255/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 83/255, green: 109/255, blue: 254/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 61/255, green: 90/255, blue: 254/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 48/255, green: 79/255, blue: 254/255, alpha: 1)
}
// deep orange
public struct deepOrange {
public static let lighten5: UIColor = UIColor(red: 232/255, green: 234/255, blue: 246/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 197/255, green: 202/255, blue: 233/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 159/255, green: 168/255, blue: 218/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 121/255, green: 134/255, blue: 203/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 92/255, green: 107/255, blue: 192/255, alpha: 1)
public static let color: UIColor = UIColor(red: 63/255, green: 81/255, blue: 181/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 57/255, green: 73/255, blue: 171/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 48/255, green: 63/255, blue: 159/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 40/255, green: 53/255, blue: 147/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 26/255, green: 35/255, blue: 126/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 140/255, green: 158/255, blue: 255/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 83/255, green: 109/255, blue: 254/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 61/255, green: 90/255, blue: 254/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 48/255, green: 79/255, blue: 254/255, alpha: 1)
}
// brown
public struct brown {
public static let lighten5: UIColor = UIColor(red: 232/255, green: 234/255, blue: 246/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 197/255, green: 202/255, blue: 233/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 159/255, green: 168/255, blue: 218/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 121/255, green: 134/255, blue: 203/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 92/255, green: 107/255, blue: 192/255, alpha: 1)
public static let color: UIColor = UIColor(red: 63/255, green: 81/255, blue: 181/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 57/255, green: 73/255, blue: 171/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 48/255, green: 63/255, blue: 159/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 40/255, green: 53/255, blue: 147/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 26/255, green: 35/255, blue: 126/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 140/255, green: 158/255, blue: 255/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 83/255, green: 109/255, blue: 254/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 61/255, green: 90/255, blue: 254/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 48/255, green: 79/255, blue: 254/255, alpha: 1)
}
// grey
public struct grey {
public static let lighten5: UIColor = UIColor(red: 232/255, green: 234/255, blue: 246/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 197/255, green: 202/255, blue: 233/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 159/255, green: 168/255, blue: 218/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 121/255, green: 134/255, blue: 203/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 92/255, green: 107/255, blue: 192/255, alpha: 1)
public static let color: UIColor = UIColor(red: 63/255, green: 81/255, blue: 181/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 57/255, green: 73/255, blue: 171/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 48/255, green: 63/255, blue: 159/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 40/255, green: 53/255, blue: 147/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 26/255, green: 35/255, blue: 126/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 140/255, green: 158/255, blue: 255/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 83/255, green: 109/255, blue: 254/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 61/255, green: 90/255, blue: 254/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 48/255, green: 79/255, blue: 254/255, alpha: 1)
}
// blue grey
public struct blueGrey {
public static let lighten5: UIColor = UIColor(red: 232/255, green: 234/255, blue: 246/255, alpha: 1)
public static let lighten4: UIColor = UIColor(red: 197/255, green: 202/255, blue: 233/255, alpha: 1)
public static let lighten3: UIColor = UIColor(red: 159/255, green: 168/255, blue: 218/255, alpha: 1)
public static let lighten2: UIColor = UIColor(red: 121/255, green: 134/255, blue: 203/255, alpha: 1)
public static let lighten1: UIColor = UIColor(red: 92/255, green: 107/255, blue: 192/255, alpha: 1)
public static let color: UIColor = UIColor(red: 96/255, green: 125/255, blue: 139/255, alpha: 1)
public static let darken1: UIColor = UIColor(red: 84/255, green: 110/255, blue: 122/255, alpha: 1)
public static let darken2: UIColor = UIColor(red: 48/255, green: 63/255, blue: 159/255, alpha: 1)
public static let darken3: UIColor = UIColor(red: 55/255, green: 71/255, blue: 79/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 38/255, green: 50/255, blue: 56/255, alpha: 1)
public static let accent1: UIColor = UIColor(red: 140/255, green: 158/255, blue: 255/255, alpha: 1)
public static let accent2: UIColor = UIColor(red: 83/255, green: 109/255, blue: 254/255, alpha: 1)
public static let accent3: UIColor = UIColor(red: 61/255, green: 90/255, blue: 254/255, alpha: 1)
public static let accent4: UIColor = UIColor(red: 48/255, green: 79/255, blue: 254/255, alpha: 1)
}
}
//
// 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 class MaterialView : UIView {
/**
:name: topLeft
*/
public func topLeft(child: UIView, top: CGFloat, left: CGFloat) {
Layout.alignFromTopLeft(self, child: child, top: top, left: left)
}
/**
:name: topRight
*/
public func topRight(child: UIView, top: CGFloat, right: CGFloat) {
Layout.alignFromTopRight(self, child: child, top: top, right: right)
}
/**
:name: bottomLeft
*/
public func bottomLeft(child: UIView, bottom: CGFloat, left: CGFloat) {
Layout.alignFromBottomLeft(self, child: child, bottom: bottom, left: left)
}
/**
:name: bottomRight
*/
public func bottomRight(child: UIView, bottom: CGFloat, right: CGFloat) {
Layout.alignFromBottomRight(self, child: child, bottom: bottom, right: right)
}
}
//
// 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 class MaterialViewController : UIViewController {
/**
:name: topLeft
*/
public func topLeft(child: UIView, top: CGFloat, left: CGFloat) {
Layout.alignFromTopLeft(view, child: child, top: top, left: left)
}
/**
:name: topRight
*/
public func topRight(child: UIView, top: CGFloat, right: CGFloat) {
Layout.alignFromTopRight(view, child: child, top: top, right: right)
}
/**
:name: bottomLeft
*/
public func bottomLeft(child: UIView, bottom: CGFloat, left: CGFloat) {
Layout.alignFromBottomLeft(view, child: child, bottom: bottom, left: left)
}
/**
:name: bottomRight
*/
public func bottomRight(child: UIView, bottom: CGFloat, right: CGFloat) {
Layout.alignFromBottomRight(view, child: child, bottom: bottom, right: right)
}
}
...@@ -22,12 +22,19 @@ public class RaisedButton : MaterialButton { ...@@ -22,12 +22,19 @@ public class RaisedButton : MaterialButton {
// //
// :name: prepareButton // :name: prepareButton
// //
internal override func prepareButton() { internal override func prepareView() {
super.prepareView()
setTitleColor(MaterialTheme.white.color, forState: .Normal)
backgroundColor = MaterialTheme.indigo.darken1
contentEdgeInsets = UIEdgeInsetsMake(10, 20, 10, 20)
}
//
// :name: prepareButton
//
internal override func prepareButton() {
super.prepareButton() super.prepareButton()
prepareShadow() prepareShadow()
setTitleColor(UIColor.whiteColor(), forState: .Normal)
pulseColor = .whiteColor()
backgroundColor = .purpleColor()
backgroundColorView.layer.cornerRadius = 3 backgroundColorView.layer.cornerRadius = 3
} }
...@@ -37,8 +44,8 @@ public class RaisedButton : MaterialButton { ...@@ -37,8 +44,8 @@ public class RaisedButton : MaterialButton {
internal override func pulseBegan(touches: Set<NSObject>, withEvent event: UIEvent) { internal override func pulseBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
super.pulseBegan(touches, withEvent: event) super.pulseBegan(touches, withEvent: event)
UIView.animateWithDuration(0.3, animations: { UIView.animateWithDuration(0.3, animations: {
self.pulseView!.transform = CGAffineTransformMakeScale(10, 10) self.pulseView!.transform = CGAffineTransformMakeScale(4, 4)
self.transform = CGAffineTransformMakeScale(1.05, 1.1) self.transform = CGAffineTransformMakeScale(1.05, 1.05)
}) })
} }
} }
......
// //
// Roboto.swift // Copyright (C) 2015 GraphKit, Inc. <http://graphkit.io> and other GraphKit contributors.
// MaterialKit
// //
// Created by Adam Dahan on 2015-08-22. // This program is free software: you can redistribute it and/or modify
// Copyright (c) 2015 GraphKit Inc. All rights reserved. // 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 import UIKit
......
...@@ -67,7 +67,7 @@ public protocol SideNavDelegate { ...@@ -67,7 +67,7 @@ public protocol SideNavDelegate {
} }
@objc(SideNavController) @objc(SideNavController)
public class SideNavController: MaterialViewController, UIGestureRecognizerDelegate { public class SideNavController: UIViewController, UIGestureRecognizerDelegate {
/** /**
:name: options :name: options
*/ */
...@@ -76,12 +76,12 @@ public class SideNavController: MaterialViewController, UIGestureRecognizerDeleg ...@@ -76,12 +76,12 @@ public class SideNavController: MaterialViewController, UIGestureRecognizerDeleg
public static var shadowRadius: CGFloat = 0 public static var shadowRadius: CGFloat = 0
public static var shadowOffset: CGSize = CGSizeZero public static var shadowOffset: CGSize = CGSizeZero
public static var contentViewScale: CGFloat = 1 public static var contentViewScale: CGFloat = 1
public static var contentViewOpacity: CGFloat = 0.4 public static var contentViewOpacity: CGFloat = 0.5
public static var hideStatusBar: Bool = true public static var hideStatusBar: Bool = true
public static var pointOfNoReturnWidth: CGFloat = 48 public static var horizontalThreshold: CGFloat = 48
public static var pointOfNoReturnheight: CGFloat = 48 public static var verticalThreshold: CGFloat = 48
public static var backdropViewContainerBackgroundColor: UIColor = .blackColor() public static var backdropBackgroundColor: UIColor = MaterialTheme.black.color
public static var animationDuration: CGFloat = 0.5 public static var animationDuration: CGFloat = 0.3
public static var leftBezelWidth: CGFloat = 16 public static var leftBezelWidth: CGFloat = 16
public static var leftViewContainerWidth: CGFloat = 240 public static var leftViewContainerWidth: CGFloat = 240
public static var leftPanFromBezel: Bool = true public static var leftPanFromBezel: Bool = true
...@@ -689,7 +689,7 @@ public class SideNavController: MaterialViewController, UIGestureRecognizerDeleg ...@@ -689,7 +689,7 @@ public class SideNavController: MaterialViewController, UIGestureRecognizerDeleg
} else { } else {
c.point = gesture.velocityInView(gesture.view) c.point = gesture.velocityInView(gesture.view)
let x: CGFloat = c.point.x >= 1000 || c.point.x <= -1000 ? c.point.x : 0 let x: CGFloat = c.point.x >= 1000 || c.point.x <= -1000 ? c.point.x : 0
c.state = vc.frame.origin.x <= CGFloat(floor(leftOriginX)) + options.pointOfNoReturnWidth || c.point.x <= -1000 ? .Closed : .Opened c.state = vc.frame.origin.x <= CGFloat(floor(leftOriginX)) + options.horizontalThreshold || c.point.x <= -1000 ? .Closed : .Opened
if .Closed == c.state { if .Closed == c.state {
closeLeftViewContainer(velocity: x) closeLeftViewContainer(velocity: x)
} else { } else {
...@@ -738,7 +738,7 @@ public class SideNavController: MaterialViewController, UIGestureRecognizerDeleg ...@@ -738,7 +738,7 @@ public class SideNavController: MaterialViewController, UIGestureRecognizerDeleg
} else { } else {
c.point = gesture.velocityInView(gesture.view) c.point = gesture.velocityInView(gesture.view)
let x: CGFloat = c.point.x <= -1000 || c.point.x >= 1000 ? c.point.x : 0 let x: CGFloat = c.point.x <= -1000 || c.point.x >= 1000 ? c.point.x : 0
c.state = vc.frame.origin.x >= CGFloat(floor(rightOriginX) - options.pointOfNoReturnWidth) || c.point.x >= 1000 ? .Closed : .Opened c.state = vc.frame.origin.x >= CGFloat(floor(rightOriginX) - options.horizontalThreshold) || c.point.x >= 1000 ? .Closed : .Opened
if .Closed == c.state { if .Closed == c.state {
closeRightViewContainer(velocity: x) closeRightViewContainer(velocity: x)
} else { } else {
...@@ -795,7 +795,7 @@ public class SideNavController: MaterialViewController, UIGestureRecognizerDeleg ...@@ -795,7 +795,7 @@ public class SideNavController: MaterialViewController, UIGestureRecognizerDeleg
if let c = bottomContainer { if let c = bottomContainer {
c.point = gesture.velocityInView(gesture.view) c.point = gesture.velocityInView(gesture.view)
let y: CGFloat = c.point.y <= -1000 || c.point.y >= 1000 ? c.point.y : 0 let y: CGFloat = c.point.y <= -1000 || c.point.y >= 1000 ? c.point.y : 0
c.state = vc.frame.origin.y >= CGFloat(floor(bottomOriginY) - options.pointOfNoReturnheight) || c.point.y >= 1000 ? .Closed : .Opened c.state = vc.frame.origin.y >= CGFloat(floor(bottomOriginY) - options.verticalThreshold) || c.point.y >= 1000 ? .Closed : .Opened
if .Closed == c.state { if .Closed == c.state {
closeBottomViewContainer(velocity: y) closeBottomViewContainer(velocity: y)
} else { } else {
...@@ -947,7 +947,7 @@ public class SideNavController: MaterialViewController, UIGestureRecognizerDeleg ...@@ -947,7 +947,7 @@ public class SideNavController: MaterialViewController, UIGestureRecognizerDeleg
// //
private func prepareBackdropContainer() { private func prepareBackdropContainer() {
backdropViewContainer = UIView(frame: view.bounds) backdropViewContainer = UIView(frame: view.bounds)
backdropViewContainer!.backgroundColor = options.backdropViewContainerBackgroundColor backdropViewContainer!.backgroundColor = options.backdropBackgroundColor
backdropViewContainer!.autoresizingMask = .FlexibleHeight | .FlexibleWidth backdropViewContainer!.autoresizingMask = .FlexibleHeight | .FlexibleWidth
backdropViewContainer!.layer.opacity = 0 backdropViewContainer!.layer.opacity = 0
view.addSubview(backdropViewContainer!) view.addSubview(backdropViewContainer!)
...@@ -1014,9 +1014,10 @@ public class SideNavController: MaterialViewController, UIGestureRecognizerDeleg ...@@ -1014,9 +1014,10 @@ public class SideNavController: MaterialViewController, UIGestureRecognizerDeleg
private func prepareContainedViewController(inout viewContainer: UIView?, inout viewController: UIViewController?) { private func prepareContainedViewController(inout viewContainer: UIView?, inout viewController: UIViewController?) {
if let vc = viewController { if let vc = viewController {
if let c = viewContainer { if let c = viewContainer {
vc.view.setTranslatesAutoresizingMaskIntoConstraints(false)
addChildViewController(vc) addChildViewController(vc)
vc.view.frame = c.bounds
c.addSubview(vc.view) c.addSubview(vc.view)
Layout.expandToParentSize(c, child: vc.view)
vc.didMoveToParentViewController(self) vc.didMoveToParentViewController(self)
} }
} }
......
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