Commit e15b9fff by Daniel Dahan

cleanup and removal of duplicate code

parent 454b272a
...@@ -41,8 +41,8 @@ ...@@ -41,8 +41,8 @@
96BCB7B31CB40DC500C806FE /* Material+UIImage+Resize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB76A1CB40DC500C806FE /* Material+UIImage+Resize.swift */; }; 96BCB7B31CB40DC500C806FE /* Material+UIImage+Resize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB76A1CB40DC500C806FE /* Material+UIImage+Resize.swift */; };
96BCB7B41CB40DC500C806FE /* Material+UIImage+Size.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB76B1CB40DC500C806FE /* Material+UIImage+Size.swift */; }; 96BCB7B41CB40DC500C806FE /* Material+UIImage+Size.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB76B1CB40DC500C806FE /* Material+UIImage+Size.swift */; };
96BCB7B51CB40DC500C806FE /* Material+UIImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB76C1CB40DC500C806FE /* Material+UIImage.swift */; }; 96BCB7B51CB40DC500C806FE /* Material+UIImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB76C1CB40DC500C806FE /* Material+UIImage.swift */; };
96BCB7B61CB40DC500C806FE /* MaterialAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB76D1CB40DC500C806FE /* MaterialAnimation.swift */; }; 96BCB7B61CB40DC500C806FE /* Animation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB76D1CB40DC500C806FE /* Animation.swift */; };
96BCB7B71CB40DC500C806FE /* MaterialBasicAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB76E1CB40DC500C806FE /* MaterialBasicAnimation.swift */; }; 96BCB7B71CB40DC500C806FE /* BasicAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB76E1CB40DC500C806FE /* BasicAnimation.swift */; };
96BCB7B81CB40DC500C806FE /* Border.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB76F1CB40DC500C806FE /* Border.swift */; }; 96BCB7B81CB40DC500C806FE /* Border.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB76F1CB40DC500C806FE /* Border.swift */; };
96BCB7B91CB40DC500C806FE /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7701CB40DC500C806FE /* Button.swift */; }; 96BCB7B91CB40DC500C806FE /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7701CB40DC500C806FE /* Button.swift */; };
96BCB7BA1CB40DC500C806FE /* MaterialCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7711CB40DC500C806FE /* MaterialCollectionView.swift */; }; 96BCB7BA1CB40DC500C806FE /* MaterialCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7711CB40DC500C806FE /* MaterialCollectionView.swift */; };
...@@ -58,11 +58,11 @@ ...@@ -58,11 +58,11 @@
96BCB7C41CB40DC500C806FE /* Font.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77B1CB40DC500C806FE /* Font.swift */; }; 96BCB7C41CB40DC500C806FE /* Font.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77B1CB40DC500C806FE /* Font.swift */; };
96BCB7C51CB40DC500C806FE /* MaterialGravity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77C1CB40DC500C806FE /* MaterialGravity.swift */; }; 96BCB7C51CB40DC500C806FE /* MaterialGravity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77C1CB40DC500C806FE /* MaterialGravity.swift */; };
96BCB7C61CB40DC500C806FE /* Icon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77D1CB40DC500C806FE /* Icon.swift */; }; 96BCB7C61CB40DC500C806FE /* Icon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77D1CB40DC500C806FE /* Icon.swift */; };
96BCB7C71CB40DC500C806FE /* MaterialKeyframeAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77E1CB40DC500C806FE /* MaterialKeyframeAnimation.swift */; }; 96BCB7C71CB40DC500C806FE /* KeyframeAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77E1CB40DC500C806FE /* KeyframeAnimation.swift */; };
96BCB7C81CB40DC500C806FE /* MaterialLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77F1CB40DC500C806FE /* MaterialLabel.swift */; }; 96BCB7C81CB40DC500C806FE /* MaterialLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77F1CB40DC500C806FE /* MaterialLabel.swift */; };
96BCB7C91CB40DC500C806FE /* Layer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7801CB40DC500C806FE /* Layer.swift */; }; 96BCB7C91CB40DC500C806FE /* Layer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7801CB40DC500C806FE /* Layer.swift */; };
96BCB7CA1CB40DC500C806FE /* Layout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7811CB40DC500C806FE /* Layout.swift */; }; 96BCB7CA1CB40DC500C806FE /* Layout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7811CB40DC500C806FE /* Layout.swift */; };
96BCB7CB1CB40DC500C806FE /* MaterialPulseAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7821CB40DC500C806FE /* MaterialPulseAnimation.swift */; }; 96BCB7CB1CB40DC500C806FE /* PulseAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7821CB40DC500C806FE /* PulseAnimation.swift */; };
96BCB7CD1CB40DC500C806FE /* PulseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7841CB40DC500C806FE /* PulseView.swift */; }; 96BCB7CD1CB40DC500C806FE /* PulseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7841CB40DC500C806FE /* PulseView.swift */; };
96BCB7CE1CB40DC500C806FE /* CornerRadius.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7851CB40DC500C806FE /* CornerRadius.swift */; }; 96BCB7CE1CB40DC500C806FE /* CornerRadius.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7851CB40DC500C806FE /* CornerRadius.swift */; };
96BCB7CF1CB40DC500C806FE /* Shape.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7861CB40DC500C806FE /* Shape.swift */; }; 96BCB7CF1CB40DC500C806FE /* Shape.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7861CB40DC500C806FE /* Shape.swift */; };
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
96BCB7D11CB40DC500C806FE /* Switch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7881CB40DC500C806FE /* Switch.swift */; }; 96BCB7D11CB40DC500C806FE /* Switch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7881CB40DC500C806FE /* Switch.swift */; };
96BCB7D21CB40DC500C806FE /* MaterialTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7891CB40DC500C806FE /* MaterialTableViewCell.swift */; }; 96BCB7D21CB40DC500C806FE /* MaterialTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7891CB40DC500C806FE /* MaterialTableViewCell.swift */; };
96BCB7D31CB40DC500C806FE /* MaterialTextLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB78A1CB40DC500C806FE /* MaterialTextLayer.swift */; }; 96BCB7D31CB40DC500C806FE /* MaterialTextLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB78A1CB40DC500C806FE /* MaterialTextLayer.swift */; };
96BCB7D41CB40DC500C806FE /* MaterialTransitionAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB78B1CB40DC500C806FE /* MaterialTransitionAnimation.swift */; }; 96BCB7D41CB40DC500C806FE /* TransitionAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB78B1CB40DC500C806FE /* TransitionAnimation.swift */; };
96BCB7D51CB40DC500C806FE /* View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB78C1CB40DC500C806FE /* View.swift */; }; 96BCB7D51CB40DC500C806FE /* View.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB78C1CB40DC500C806FE /* View.swift */; };
96BCB7D61CB40DC500C806FE /* Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB78D1CB40DC500C806FE /* Menu.swift */; }; 96BCB7D61CB40DC500C806FE /* Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB78D1CB40DC500C806FE /* Menu.swift */; };
96BCB7D71CB40DC500C806FE /* MenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB78E1CB40DC500C806FE /* MenuView.swift */; }; 96BCB7D71CB40DC500C806FE /* MenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB78E1CB40DC500C806FE /* MenuView.swift */; };
...@@ -103,11 +103,11 @@ ...@@ -103,11 +103,11 @@
96BCB7FB1CB40DE900C806FE /* Roboto-Thin.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 96BCB7F21CB40DE900C806FE /* Roboto-Thin.ttf */; }; 96BCB7FB1CB40DE900C806FE /* Roboto-Thin.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 96BCB7F21CB40DE900C806FE /* Roboto-Thin.ttf */; };
96BCB7FC1CB40DE900C806FE /* Roboto-Thin.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 96BCB7F21CB40DE900C806FE /* Roboto-Thin.ttf */; }; 96BCB7FC1CB40DE900C806FE /* Roboto-Thin.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 96BCB7F21CB40DE900C806FE /* Roboto-Thin.ttf */; };
96BCB7FE1CB40E1D00C806FE /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7FD1CB40E1D00C806FE /* Color.swift */; }; 96BCB7FE1CB40E1D00C806FE /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7FD1CB40E1D00C806FE /* Color.swift */; };
96BCB8101CB4115200C806FE /* MaterialTransitionAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB78B1CB40DC500C806FE /* MaterialTransitionAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8101CB4115200C806FE /* TransitionAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB78B1CB40DC500C806FE /* TransitionAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8111CB4115200C806FE /* MaterialAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB76D1CB40DC500C806FE /* MaterialAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8111CB4115200C806FE /* Animation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB76D1CB40DC500C806FE /* Animation.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8121CB4115200C806FE /* MaterialBasicAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB76E1CB40DC500C806FE /* MaterialBasicAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8121CB4115200C806FE /* BasicAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB76E1CB40DC500C806FE /* BasicAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8131CB4115200C806FE /* MaterialKeyframeAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB77E1CB40DC500C806FE /* MaterialKeyframeAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8131CB4115200C806FE /* KeyframeAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB77E1CB40DC500C806FE /* KeyframeAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8141CB4115200C806FE /* MaterialPulseAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7821CB40DC500C806FE /* MaterialPulseAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8141CB4115200C806FE /* PulseAnimation.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7821CB40DC500C806FE /* PulseAnimation.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8151CB4115200C806FE /* FabButton.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB75F1CB40DC500C806FE /* FabButton.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8151CB4115200C806FE /* FabButton.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB75F1CB40DC500C806FE /* FabButton.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8161CB4115200C806FE /* FlatButton.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7601CB40DC500C806FE /* FlatButton.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8161CB4115200C806FE /* FlatButton.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7601CB40DC500C806FE /* FlatButton.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8171CB4115200C806FE /* Button.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7701CB40DC500C806FE /* Button.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8171CB4115200C806FE /* Button.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7701CB40DC500C806FE /* Button.swift */; settings = {ATTRIBUTES = (Public, ); }; };
...@@ -235,8 +235,8 @@ ...@@ -235,8 +235,8 @@
96BCB76A1CB40DC500C806FE /* Material+UIImage+Resize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIImage+Resize.swift"; sourceTree = "<group>"; }; 96BCB76A1CB40DC500C806FE /* Material+UIImage+Resize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIImage+Resize.swift"; sourceTree = "<group>"; };
96BCB76B1CB40DC500C806FE /* Material+UIImage+Size.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIImage+Size.swift"; sourceTree = "<group>"; }; 96BCB76B1CB40DC500C806FE /* Material+UIImage+Size.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIImage+Size.swift"; sourceTree = "<group>"; };
96BCB76C1CB40DC500C806FE /* Material+UIImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIImage.swift"; sourceTree = "<group>"; }; 96BCB76C1CB40DC500C806FE /* Material+UIImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Material+UIImage.swift"; sourceTree = "<group>"; };
96BCB76D1CB40DC500C806FE /* MaterialAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialAnimation.swift; sourceTree = "<group>"; }; 96BCB76D1CB40DC500C806FE /* Animation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Animation.swift; sourceTree = "<group>"; };
96BCB76E1CB40DC500C806FE /* MaterialBasicAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialBasicAnimation.swift; sourceTree = "<group>"; }; 96BCB76E1CB40DC500C806FE /* BasicAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicAnimation.swift; sourceTree = "<group>"; };
96BCB76F1CB40DC500C806FE /* Border.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Border.swift; sourceTree = "<group>"; }; 96BCB76F1CB40DC500C806FE /* Border.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Border.swift; sourceTree = "<group>"; };
96BCB7701CB40DC500C806FE /* Button.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = "<group>"; }; 96BCB7701CB40DC500C806FE /* Button.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = "<group>"; };
96BCB7711CB40DC500C806FE /* MaterialCollectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialCollectionView.swift; sourceTree = "<group>"; }; 96BCB7711CB40DC500C806FE /* MaterialCollectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialCollectionView.swift; sourceTree = "<group>"; };
...@@ -252,11 +252,11 @@ ...@@ -252,11 +252,11 @@
96BCB77B1CB40DC500C806FE /* Font.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Font.swift; sourceTree = "<group>"; }; 96BCB77B1CB40DC500C806FE /* Font.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Font.swift; sourceTree = "<group>"; };
96BCB77C1CB40DC500C806FE /* MaterialGravity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialGravity.swift; sourceTree = "<group>"; }; 96BCB77C1CB40DC500C806FE /* MaterialGravity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialGravity.swift; sourceTree = "<group>"; };
96BCB77D1CB40DC500C806FE /* Icon.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Icon.swift; sourceTree = "<group>"; }; 96BCB77D1CB40DC500C806FE /* Icon.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Icon.swift; sourceTree = "<group>"; };
96BCB77E1CB40DC500C806FE /* MaterialKeyframeAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialKeyframeAnimation.swift; sourceTree = "<group>"; }; 96BCB77E1CB40DC500C806FE /* KeyframeAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyframeAnimation.swift; sourceTree = "<group>"; };
96BCB77F1CB40DC500C806FE /* MaterialLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialLabel.swift; sourceTree = "<group>"; }; 96BCB77F1CB40DC500C806FE /* MaterialLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialLabel.swift; sourceTree = "<group>"; };
96BCB7801CB40DC500C806FE /* Layer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Layer.swift; sourceTree = "<group>"; }; 96BCB7801CB40DC500C806FE /* Layer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Layer.swift; sourceTree = "<group>"; };
96BCB7811CB40DC500C806FE /* Layout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Layout.swift; sourceTree = "<group>"; }; 96BCB7811CB40DC500C806FE /* Layout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Layout.swift; sourceTree = "<group>"; };
96BCB7821CB40DC500C806FE /* MaterialPulseAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialPulseAnimation.swift; sourceTree = "<group>"; }; 96BCB7821CB40DC500C806FE /* PulseAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PulseAnimation.swift; sourceTree = "<group>"; };
96BCB7841CB40DC500C806FE /* PulseView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PulseView.swift; sourceTree = "<group>"; }; 96BCB7841CB40DC500C806FE /* PulseView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PulseView.swift; sourceTree = "<group>"; };
96BCB7851CB40DC500C806FE /* CornerRadius.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CornerRadius.swift; sourceTree = "<group>"; }; 96BCB7851CB40DC500C806FE /* CornerRadius.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CornerRadius.swift; sourceTree = "<group>"; };
96BCB7861CB40DC500C806FE /* Shape.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Shape.swift; sourceTree = "<group>"; }; 96BCB7861CB40DC500C806FE /* Shape.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Shape.swift; sourceTree = "<group>"; };
...@@ -264,7 +264,7 @@ ...@@ -264,7 +264,7 @@
96BCB7881CB40DC500C806FE /* Switch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Switch.swift; sourceTree = "<group>"; }; 96BCB7881CB40DC500C806FE /* Switch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Switch.swift; sourceTree = "<group>"; };
96BCB7891CB40DC500C806FE /* MaterialTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTableViewCell.swift; sourceTree = "<group>"; }; 96BCB7891CB40DC500C806FE /* MaterialTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTableViewCell.swift; sourceTree = "<group>"; };
96BCB78A1CB40DC500C806FE /* MaterialTextLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTextLayer.swift; sourceTree = "<group>"; }; 96BCB78A1CB40DC500C806FE /* MaterialTextLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTextLayer.swift; sourceTree = "<group>"; };
96BCB78B1CB40DC500C806FE /* MaterialTransitionAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTransitionAnimation.swift; sourceTree = "<group>"; }; 96BCB78B1CB40DC500C806FE /* TransitionAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransitionAnimation.swift; sourceTree = "<group>"; };
96BCB78C1CB40DC500C806FE /* View.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = View.swift; sourceTree = "<group>"; }; 96BCB78C1CB40DC500C806FE /* View.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = View.swift; sourceTree = "<group>"; };
96BCB78D1CB40DC500C806FE /* Menu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Menu.swift; sourceTree = "<group>"; }; 96BCB78D1CB40DC500C806FE /* Menu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Menu.swift; sourceTree = "<group>"; };
96BCB78E1CB40DC500C806FE /* MenuView.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = MenuView.swift; sourceTree = "<group>"; tabWidth = 4; }; 96BCB78E1CB40DC500C806FE /* MenuView.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = MenuView.swift; sourceTree = "<group>"; tabWidth = 4; };
...@@ -396,7 +396,7 @@ ...@@ -396,7 +396,7 @@
96BCB7571CB40DC500C806FE /* iOS */ = { 96BCB7571CB40DC500C806FE /* iOS */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96BCB8091CB4107700C806FE /* Animation */, 96BCB8091CB4107700C806FE /* Animate */,
96BCB8031CB40F4B00C806FE /* Button */, 96BCB8031CB40F4B00C806FE /* Button */,
96BCB8021CB40F3B00C806FE /* Card */, 96BCB8021CB40F3B00C806FE /* Card */,
96BCB7FF1CB40EF000C806FE /* Capture */, 96BCB7FF1CB40EF000C806FE /* Capture */,
...@@ -567,16 +567,16 @@ ...@@ -567,16 +567,16 @@
name = Icon; name = Icon;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
96BCB8091CB4107700C806FE /* Animation */ = { 96BCB8091CB4107700C806FE /* Animate */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96BCB78B1CB40DC500C806FE /* MaterialTransitionAnimation.swift */, 96BCB76D1CB40DC500C806FE /* Animation.swift */,
96BCB76D1CB40DC500C806FE /* MaterialAnimation.swift */, 96BCB78B1CB40DC500C806FE /* TransitionAnimation.swift */,
96BCB76E1CB40DC500C806FE /* MaterialBasicAnimation.swift */, 96BCB76E1CB40DC500C806FE /* BasicAnimation.swift */,
96BCB77E1CB40DC500C806FE /* MaterialKeyframeAnimation.swift */, 96BCB77E1CB40DC500C806FE /* KeyframeAnimation.swift */,
96BCB7821CB40DC500C806FE /* MaterialPulseAnimation.swift */, 96BCB7821CB40DC500C806FE /* PulseAnimation.swift */,
); );
name = Animation; name = Animate;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
96BCB80A1CB410A100C806FE /* Extension */ = { 96BCB80A1CB410A100C806FE /* Extension */ = {
...@@ -667,11 +667,11 @@ ...@@ -667,11 +667,11 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
96D88C321C1328D800B91418 /* Material.h in Headers */, 96D88C321C1328D800B91418 /* Material.h in Headers */,
96BCB8101CB4115200C806FE /* MaterialTransitionAnimation.swift in Headers */, 96BCB8101CB4115200C806FE /* TransitionAnimation.swift in Headers */,
96BCB8111CB4115200C806FE /* MaterialAnimation.swift in Headers */, 96BCB8111CB4115200C806FE /* Animation.swift in Headers */,
96BCB8121CB4115200C806FE /* MaterialBasicAnimation.swift in Headers */, 96BCB8121CB4115200C806FE /* BasicAnimation.swift in Headers */,
96BCB8131CB4115200C806FE /* MaterialKeyframeAnimation.swift in Headers */, 96BCB8131CB4115200C806FE /* KeyframeAnimation.swift in Headers */,
96BCB8141CB4115200C806FE /* MaterialPulseAnimation.swift in Headers */, 96BCB8141CB4115200C806FE /* PulseAnimation.swift in Headers */,
96BCB8151CB4115200C806FE /* FabButton.swift in Headers */, 96BCB8151CB4115200C806FE /* FabButton.swift in Headers */,
96BCB8161CB4115200C806FE /* FlatButton.swift in Headers */, 96BCB8161CB4115200C806FE /* FlatButton.swift in Headers */,
96BCB8171CB4115200C806FE /* Button.swift in Headers */, 96BCB8171CB4115200C806FE /* Button.swift in Headers */,
...@@ -941,7 +941,7 @@ ...@@ -941,7 +941,7 @@
96BCB7A31CB40DC500C806FE /* CapturePreview.swift in Sources */, 96BCB7A31CB40DC500C806FE /* CapturePreview.swift in Sources */,
96BCB7BC1CB40DC500C806FE /* MaterialCollectionViewDataSource.swift in Sources */, 96BCB7BC1CB40DC500C806FE /* MaterialCollectionViewDataSource.swift in Sources */,
96E3C3941D397AE90086A024 /* Material.swift in Sources */, 96E3C3941D397AE90086A024 /* Material.swift in Sources */,
96BCB7C71CB40DC500C806FE /* MaterialKeyframeAnimation.swift in Sources */, 96BCB7C71CB40DC500C806FE /* KeyframeAnimation.swift in Sources */,
96BCB7BE1CB40DC500C806FE /* MaterialCollectionViewLayout.swift in Sources */, 96BCB7BE1CB40DC500C806FE /* MaterialCollectionViewLayout.swift in Sources */,
96BCB7BF1CB40DC500C806FE /* Color.swift in Sources */, 96BCB7BF1CB40DC500C806FE /* Color.swift in Sources */,
96BCB7C61CB40DC500C806FE /* Icon.swift in Sources */, 96BCB7C61CB40DC500C806FE /* Icon.swift in Sources */,
...@@ -963,7 +963,7 @@ ...@@ -963,7 +963,7 @@
96BCB7E11CB40DC500C806FE /* BarView.swift in Sources */, 96BCB7E11CB40DC500C806FE /* BarView.swift in Sources */,
96BCB7A11CB40DC500C806FE /* BottomNavigationController.swift in Sources */, 96BCB7A11CB40DC500C806FE /* BottomNavigationController.swift in Sources */,
96BCB7D81CB40DC500C806FE /* MenuController.swift in Sources */, 96BCB7D81CB40DC500C806FE /* MenuController.swift in Sources */,
96BCB7D41CB40DC500C806FE /* MaterialTransitionAnimation.swift in Sources */, 96BCB7D41CB40DC500C806FE /* TransitionAnimation.swift in Sources */,
967A48191D0F425A00B8CEB7 /* StatusBarController.swift in Sources */, 967A48191D0F425A00B8CEB7 /* StatusBarController.swift in Sources */,
96BCB7C21CB40DC500C806FE /* Device.swift in Sources */, 96BCB7C21CB40DC500C806FE /* Device.swift in Sources */,
96BCB7A41CB40DC500C806FE /* CaptureSession.swift in Sources */, 96BCB7A41CB40DC500C806FE /* CaptureSession.swift in Sources */,
...@@ -982,7 +982,7 @@ ...@@ -982,7 +982,7 @@
966ECF2A1CF4C20100BB0BDF /* MaterialCollectionReusableView.swift in Sources */, 966ECF2A1CF4C20100BB0BDF /* MaterialCollectionReusableView.swift in Sources */,
96BCB7E51CB40DC500C806FE /* TextField.swift in Sources */, 96BCB7E51CB40DC500C806FE /* TextField.swift in Sources */,
96BCB7D21CB40DC500C806FE /* MaterialTableViewCell.swift in Sources */, 96BCB7D21CB40DC500C806FE /* MaterialTableViewCell.swift in Sources */,
96BCB7B61CB40DC500C806FE /* MaterialAnimation.swift in Sources */, 96BCB7B61CB40DC500C806FE /* Animation.swift in Sources */,
96BCB7A71CB40DC500C806FE /* ControlView.swift in Sources */, 96BCB7A71CB40DC500C806FE /* ControlView.swift in Sources */,
96BCB7DB1CB40DC500C806FE /* NavigationItem.swift in Sources */, 96BCB7DB1CB40DC500C806FE /* NavigationItem.swift in Sources */,
96BCB7E01CB40DC500C806FE /* NavigationDrawerController.swift in Sources */, 96BCB7E01CB40DC500C806FE /* NavigationDrawerController.swift in Sources */,
...@@ -998,8 +998,8 @@ ...@@ -998,8 +998,8 @@
96BCB7E41CB40DC500C806FE /* Text.swift in Sources */, 96BCB7E41CB40DC500C806FE /* Text.swift in Sources */,
96BCB7AB1CB40DC500C806FE /* ImageCard.swift in Sources */, 96BCB7AB1CB40DC500C806FE /* ImageCard.swift in Sources */,
96977DA61CBB2E49000BEFC4 /* Material+UIImage+FilterBlur.swift in Sources */, 96977DA61CBB2E49000BEFC4 /* Material+UIImage+FilterBlur.swift in Sources */,
96BCB7CB1CB40DC500C806FE /* MaterialPulseAnimation.swift in Sources */, 96BCB7CB1CB40DC500C806FE /* PulseAnimation.swift in Sources */,
96BCB7B71CB40DC500C806FE /* MaterialBasicAnimation.swift in Sources */, 96BCB7B71CB40DC500C806FE /* BasicAnimation.swift in Sources */,
96BCB7AE1CB40DC500C806FE /* Material+UIFont.swift in Sources */, 96BCB7AE1CB40DC500C806FE /* Material+UIFont.swift in Sources */,
96BCB7D91CB40DC500C806FE /* NavigationBar.swift in Sources */, 96BCB7D91CB40DC500C806FE /* NavigationBar.swift in Sources */,
); );
......
/* /*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>. * Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* *
* * Redistributions of source code must retain the above copyright notice, this * * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer. * list of conditions and the following disclaimer.
* *
* * Redistributions in binary form must reproduce the above copyright notice, * * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* *
* * Neither the name of CosmicMind nor the names of its * * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from * contributors may be used to endorse or promote products derived from
* this software without specific prior written permission. * this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
import AppKit import UIKit
public struct Color { public struct Color {
// clear // clear
public static let clear: NSColor = NSColor.clearColor() public static let clear: NSColor = NSColor.clear()
// white // white
public static let white: NSColor = NSColor.whiteColor() public static let white: NSColor = NSColor.white()
// black // black
public static let black: NSColor = NSColor.blackColor() public static let black: NSColor = NSColor.black()
// dark text // dark text
public struct darkText { public struct darkText {
public static let primary: NSColor = NSColor.blackColor().colorWithAlphaComponent(0.87) public static let primary: NSColor = Color.black.withAlphaComponent(0.87)
public static let secondary: NSColor = NSColor.blackColor().colorWithAlphaComponent(0.54) public static let secondary: NSColor = Color.black.withAlphaComponent(0.54)
public static let others: NSColor = NSColor.blackColor().colorWithAlphaComponent(0.38) public static let others: NSColor = Color.black.withAlphaComponent(0.38)
public static let dividers: NSColor = NSColor.blackColor().colorWithAlphaComponent(0.12) public static let dividers: NSColor = Color.black.withAlphaComponent(0.12)
} }
// light text // light text
public struct lightText { public struct lightText {
public static let primary: NSColor = NSColor.whiteColor() public static let primary: NSColor = Color.white
public static let secondary: NSColor = NSColor.whiteColor().colorWithAlphaComponent(0.7) public static let secondary: NSColor = Color.white.withAlphaComponent(0.7)
public static let others: NSColor = NSColor.whiteColor().colorWithAlphaComponent(0.5) public static let others: NSColor = Color.white.withAlphaComponent(0.5)
public static let dividers: NSColor = NSColor.whiteColor().colorWithAlphaComponent(0.12) public static let dividers: NSColor = Color.white.withAlphaComponent(0.12)
} }
// red // red
...@@ -326,6 +326,7 @@ public struct Color { ...@@ -326,6 +326,7 @@ public struct Color {
public static let accent4: NSColor = NSColor(red: 255/255, green: 109/255, blue: 0/255, alpha: 1) public static let accent4: NSColor = NSColor(red: 255/255, green: 109/255, blue: 0/255, alpha: 1)
} }
// deep orange // deep orange
public struct deepOrange { public struct deepOrange {
public static let lighten5: NSColor = NSColor(red: 251/255, green: 233/255, blue: 231/255, alpha: 1) public static let lighten5: NSColor = NSColor(red: 251/255, green: 233/255, blue: 231/255, alpha: 1)
...@@ -344,6 +345,7 @@ public struct Color { ...@@ -344,6 +345,7 @@ public struct Color {
public static let accent4: NSColor = NSColor(red: 221/255, green: 44/255, blue: 0/255, alpha: 1) public static let accent4: NSColor = NSColor(red: 221/255, green: 44/255, blue: 0/255, alpha: 1)
} }
// brown // brown
public struct brown { public struct brown {
public static let lighten5: NSColor = NSColor(red: 239/255, green: 235/255, blue: 233/255, alpha: 1) public static let lighten5: NSColor = NSColor(red: 239/255, green: 235/255, blue: 233/255, alpha: 1)
......
...@@ -30,18 +30,18 @@ ...@@ -30,18 +30,18 @@
import UIKit import UIKit
public typealias MaterialAnimationRotationModeType = String public typealias AnimateRotationModeType = String
public enum MaterialAnimationRotationMode { public enum AnimateRotationMode {
case None case None
case Auto case Auto
case AutoReverse case AutoReverse
} }
/** /**
:name: MaterialAnimationRotationModeToValue :name: AnimateRotationModeToValue
*/ */
public func MaterialAnimationRotationModeToValue(mode: MaterialAnimationRotationMode) -> MaterialAnimationRotationModeType? { public func AnimateRotationModeToValue(mode: AnimateRotationMode) -> AnimateRotationModeType? {
switch mode { switch mode {
case .none: case .none:
return nil return nil
...@@ -52,15 +52,15 @@ public func MaterialAnimationRotationModeToValue(mode: MaterialAnimationRotation ...@@ -52,15 +52,15 @@ public func MaterialAnimationRotationModeToValue(mode: MaterialAnimationRotation
} }
} }
public extension MaterialAnimation { public extension Animate {
/** /**
:name: path :name: path
*/ */
public static func path(bezierPath: UIBezierPath, mode: MaterialAnimationRotationMode = .Auto, duration: CFTimeInterval? = nil) -> CAKeyframeAnimation { public static func path(bezierPath: UIBezierPath, mode: AnimateRotationMode = .Auto, duration: CFTimeInterval? = nil) -> CAKeyframeAnimation {
let animation: CAKeyframeAnimation = CAKeyframeAnimation() let animation: CAKeyframeAnimation = CAKeyframeAnimation()
animation.keyPath = "position" animation.keyPath = "position"
animation.path = bezierPath.CGPath animation.path = bezierPath.CGPath
animation.rotationMode = MaterialAnimationRotationModeToValue(mode) animation.rotationMode = AnimateRotationModeToValue(mode)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
} }
......
...@@ -30,52 +30,46 @@ ...@@ -30,52 +30,46 @@
import UIKit import UIKit
@objc(MaterialAnimationDelegate) public typealias AnimationFillModeType = String
public protocol MaterialAnimationDelegate : MaterialDelegate {
optional func materialAnimationDidStart(animation: CAAnimation)
optional func materialAnimationDidStop(animation: CAAnimation, finished flag: Bool)
}
public typealias MaterialAnimationFillModeType = String
public enum MaterialAnimationFillMode { public enum AnimationFillMode {
case Forwards case forwards
case Backwards case backwards
case Both case both
case Removed case removed
} }
/** /**
:name: MaterialAnimationFillModeToValue :name: AnimationFillModeToValue
*/ */
public func MaterialAnimationFillModeToValue(mode: MaterialAnimationFillMode) -> MaterialAnimationFillModeType { public func AnimationFillModeToValue(mode: AnimationFillMode) -> AnimationFillModeType {
switch mode { switch mode {
case .Forwards: case .forwards:
return kCAFillModeForwards return kCAFillModeForwards
case .Backwards: case .backwards:
return kCAFillModeBackwards return kCAFillModeBackwards
case .Both: case .both:
return kCAFillModeBoth return kCAFillModeBoth
case .Removed: case .removed:
return kCAFillModeRemoved return kCAFillModeRemoved
} }
} }
public typealias MaterialAnimationDelayCancelBlock = (cancel : Bool) -> Void public typealias AnimationDelayCancelBlock = (cancel : Bool) -> Void
public struct MaterialAnimation { public struct Animation {
/// Delay helper method. /// Delay helper method.
public static func delay(time: TimeInterval, completion: ()-> Void) -> MaterialAnimationDelayCancelBlock? { public static func delay(time: TimeInterval, completion: ()-> Void) -> AnimationDelayCancelBlock? {
func dispatch_later(completion: ()-> Void) { func dispatch_later(completion: ()-> Void) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(time * Double(NSEC_PER_SEC))), dispatch_get_main_queue(), completion) DispatchQueue.main.after(when: DispatchTime.now() + time, execute: completion)
} }
var cancelable: MaterialAnimationDelayCancelBlock? var cancelable: AnimationDelayCancelBlock?
let delayed: MaterialAnimationDelayCancelBlock = { (cancel: Bool) in let delayed: AnimationDelayCancelBlock = { (cancel: Bool) in
if !cancel { if !cancel {
dispatch_async(dispatch_get_main_queue(), completion) DispatchQueue.main.asynchronously(execute: completion)
} }
cancelable = nil cancelable = nil
} }
...@@ -92,7 +86,7 @@ public struct MaterialAnimation { ...@@ -92,7 +86,7 @@ public struct MaterialAnimation {
/** /**
:name: delayCancel :name: delayCancel
*/ */
public static func delayCancel(completion: MaterialAnimationDelayCancelBlock?) { public static func delayCancel(completion: AnimationDelayCancelBlock?) {
completion?(cancel: true) completion?(cancel: true)
} }
...@@ -101,7 +95,7 @@ public struct MaterialAnimation { ...@@ -101,7 +95,7 @@ public struct MaterialAnimation {
:name: animationDisabled :name: animationDisabled
*/ */
public static func animationDisabled(animations: (() -> Void)) { public static func animationDisabled(animations: (() -> Void)) {
animateWithDuration(0, animations: animations) animateWithDuration(duration: 0, animations: animations)
} }
/** /**
...@@ -119,10 +113,10 @@ public struct MaterialAnimation { ...@@ -119,10 +113,10 @@ public struct MaterialAnimation {
/** /**
:name: animationGroup :name: animationGroup
*/ */
public static func animationGroup(animations: Array<CAAnimation>, duration: CFTimeInterval = 0.5) -> CAAnimationGroup { public static func animationGroup(animations: [CAAnimation], duration: CFTimeInterval = 0.5) -> CAAnimationGroup {
let group: CAAnimationGroup = CAAnimationGroup() let group: CAAnimationGroup = CAAnimationGroup()
group.fillMode = MaterialAnimationFillModeToValue(.Forwards) group.fillMode = AnimationFillModeToValue(mode: .forwards)
group.removedOnCompletion = false group.isRemovedOnCompletion = false
group.animations = animations group.animations = animations
group.duration = duration group.duration = duration
group.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) group.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
...@@ -133,8 +127,8 @@ public struct MaterialAnimation { ...@@ -133,8 +127,8 @@ public struct MaterialAnimation {
:name: animateWithDelay :name: animateWithDelay
*/ */
public static func animateWithDelay(delay d: CFTimeInterval, duration: CFTimeInterval, animations: (() -> Void), completion: (() -> Void)? = nil) { public static func animateWithDelay(delay d: CFTimeInterval, duration: CFTimeInterval, animations: (() -> Void), completion: (() -> Void)? = nil) {
delay(d) { delay(time: d) {
animateWithDuration(duration, animations: animations, completion: completion) animateWithDuration(duration: duration, animations: animations, completion: completion)
} }
} }
} }
...@@ -30,14 +30,14 @@ ...@@ -30,14 +30,14 @@
import UIKit import UIKit
public extension MaterialAnimation { public extension Animation {
/** /**
:name: backgroundColor :name: backgroundColor
*/ */
public static func backgroundColor(color: UIColor, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func backgroundColor(color: UIColor, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "backgroundColor") let animation: CABasicAnimation = CABasicAnimation(keyPath: "backgroundColor")
animation.toValue = color.cgColor animation.toValue = color.cgColor
animation.fillMode = MaterialAnimationFillModeToValue(mode: .Forwards) animation.fillMode = AnimationFillModeToValue(mode: .forwards)
animation.isRemovedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
...@@ -52,7 +52,7 @@ public extension MaterialAnimation { ...@@ -52,7 +52,7 @@ public extension MaterialAnimation {
public static func cornerRadius(radius: CGFloat, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func cornerRadius(radius: CGFloat, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "cornerRadius") let animation: CABasicAnimation = CABasicAnimation(keyPath: "cornerRadius")
animation.toValue = radius animation.toValue = radius
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = AnimationFillModeToValue(mode: .forwards)
animation.isRemovedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
...@@ -66,8 +66,8 @@ public extension MaterialAnimation { ...@@ -66,8 +66,8 @@ public extension MaterialAnimation {
*/ */
public static func transform(transform: CATransform3D, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func transform(transform: CATransform3D, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform") let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform")
animation.toValue = NSValue(CATransform3D: transform) animation.toValue = NSValue(caTransform3D: transform)
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = AnimationFillModeToValue(mode: .forwards)
animation.isRemovedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
...@@ -79,15 +79,15 @@ public extension MaterialAnimation { ...@@ -79,15 +79,15 @@ public extension MaterialAnimation {
/** /**
:name: rotate :name: rotate
*/ */
public static func rotate(angle angle: CGFloat? = nil, rotation: CGFloat? = nil, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func rotate(angle: CGFloat? = nil, rotation: CGFloat? = nil, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation") let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation")
if let v: CGFloat = angle { if let v: CGFloat = angle {
animation.toValue = (CGFloat(M_PI) * v / 180) as NSNumber animation.toValue = (CGFloat(M_PI) * v / 180) as NSNumber
} else if let v: CGFloat = rotation { } else if let v: CGFloat = rotation {
animation.toValue = (CGFloat(M_PI * 2) * v) as NSNumber animation.toValue = (CGFloat(M_PI * 2) * v) as NSNumber
} }
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = AnimationFillModeToValue(mode: .forwards)
animation.removedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
...@@ -98,15 +98,15 @@ public extension MaterialAnimation { ...@@ -98,15 +98,15 @@ public extension MaterialAnimation {
/** /**
:name: rotateX :name: rotateX
*/ */
public static func rotateX(angle angle: CGFloat? = nil, rotation: CGFloat? = nil, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func rotateX(angle: CGFloat? = nil, rotation: CGFloat? = nil, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation.x") let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation.x")
if let v: CGFloat = angle { if let v: CGFloat = angle {
animation.toValue = (CGFloat(M_PI) * v / 180) as NSNumber animation.toValue = (CGFloat(M_PI) * v / 180) as NSNumber
} else if let v: CGFloat = rotation { } else if let v: CGFloat = rotation {
animation.toValue = (CGFloat(M_PI * 2) * v) as NSNumber animation.toValue = (CGFloat(M_PI * 2) * v) as NSNumber
} }
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = AnimationFillModeToValue(mode: .forwards)
animation.removedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
...@@ -117,15 +117,15 @@ public extension MaterialAnimation { ...@@ -117,15 +117,15 @@ public extension MaterialAnimation {
/** /**
:name: rotateY :name: rotateY
*/ */
public static func rotateY(angle angle: CGFloat? = nil, rotation: CGFloat? = nil, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func rotateY(angle: CGFloat? = nil, rotation: CGFloat? = nil, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation.y") let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation.y")
if let v: CGFloat = angle { if let v: CGFloat = angle {
animation.toValue = (CGFloat(M_PI) * v / 180) as NSNumber animation.toValue = (CGFloat(M_PI) * v / 180) as NSNumber
} else if let v: CGFloat = rotation { } else if let v: CGFloat = rotation {
animation.toValue = (CGFloat(M_PI * 2) * v) as NSNumber animation.toValue = (CGFloat(M_PI * 2) * v) as NSNumber
} }
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = AnimationFillModeToValue(mode: .forwards)
animation.removedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
...@@ -136,15 +136,15 @@ public extension MaterialAnimation { ...@@ -136,15 +136,15 @@ public extension MaterialAnimation {
/** /**
:name: rotateZ :name: rotateZ
*/ */
public static func rotateZ(angle angle: CGFloat? = nil, rotation: CGFloat? = nil, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func rotateZ(angle: CGFloat? = nil, rotation: CGFloat? = nil, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation.z") let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
if let v: CGFloat = angle { if let v: CGFloat = angle {
animation.toValue = (CGFloat(M_PI) * v / 180) as NSNumber animation.toValue = (CGFloat(M_PI) * v / 180) as NSNumber
} else if let v: CGFloat = rotation { } else if let v: CGFloat = rotation {
animation.toValue = (CGFloat(M_PI * 2) * v) as NSNumber animation.toValue = (CGFloat(M_PI * 2) * v) as NSNumber
} }
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = AnimationFillModeToValue(mode: .forwards)
animation.removedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
...@@ -158,8 +158,8 @@ public extension MaterialAnimation { ...@@ -158,8 +158,8 @@ public extension MaterialAnimation {
public static func scale(scale: CGFloat, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func scale(scale: CGFloat, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.scale") let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.scale")
animation.toValue = scale as NSNumber animation.toValue = scale as NSNumber
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = AnimationFillModeToValue(mode: .forwards)
animation.removedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
...@@ -173,8 +173,8 @@ public extension MaterialAnimation { ...@@ -173,8 +173,8 @@ public extension MaterialAnimation {
public static func scaleX(scale: CGFloat, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func scaleX(scale: CGFloat, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.scale.x") let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.scale.x")
animation.toValue = scale as NSNumber animation.toValue = scale as NSNumber
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = AnimationFillModeToValue(mode: .forwards)
animation.removedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
...@@ -188,8 +188,8 @@ public extension MaterialAnimation { ...@@ -188,8 +188,8 @@ public extension MaterialAnimation {
public static func scaleY(scale: CGFloat, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func scaleY(scale: CGFloat, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.scale.y") let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.scale.y")
animation.toValue = scale as NSNumber animation.toValue = scale as NSNumber
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = AnimationFillModeToValue(mode: .forwards)
animation.removedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
...@@ -203,8 +203,8 @@ public extension MaterialAnimation { ...@@ -203,8 +203,8 @@ public extension MaterialAnimation {
public static func scaleZ(scale: CGFloat, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func scaleZ(scale: CGFloat, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.scale.z") let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.scale.z")
animation.toValue = scale as NSNumber animation.toValue = scale as NSNumber
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = AnimationFillModeToValue(mode: .forwards)
animation.removedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
...@@ -217,9 +217,9 @@ public extension MaterialAnimation { ...@@ -217,9 +217,9 @@ public extension MaterialAnimation {
*/ */
public static func translate(translation: CGSize, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func translate(translation: CGSize, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.translation") let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.translation")
animation.toValue = NSValue(CGSize: translation) animation.toValue = NSValue(cgSize: translation)
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = AnimationFillModeToValue(mode: .forwards)
animation.removedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
...@@ -233,8 +233,8 @@ public extension MaterialAnimation { ...@@ -233,8 +233,8 @@ public extension MaterialAnimation {
public static func translateX(translation: CGFloat, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func translateX(translation: CGFloat, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.translation.x") let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.translation.x")
animation.toValue = translation as NSNumber animation.toValue = translation as NSNumber
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = AnimationFillModeToValue(mode: .forwards)
animation.removedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
...@@ -248,8 +248,8 @@ public extension MaterialAnimation { ...@@ -248,8 +248,8 @@ public extension MaterialAnimation {
public static func translateY(translation: CGFloat, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func translateY(translation: CGFloat, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.translation.y") let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.translation.y")
animation.toValue = translation as NSNumber animation.toValue = translation as NSNumber
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = AnimationFillModeToValue(mode: .forwards)
animation.removedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
...@@ -263,8 +263,8 @@ public extension MaterialAnimation { ...@@ -263,8 +263,8 @@ public extension MaterialAnimation {
public static func translateZ(translation: CGFloat, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func translateZ(translation: CGFloat, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.translation.z") let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.translation.z")
animation.toValue = translation as NSNumber animation.toValue = translation as NSNumber
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = AnimationFillModeToValue(mode: .forwards)
animation.removedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
...@@ -277,9 +277,9 @@ public extension MaterialAnimation { ...@@ -277,9 +277,9 @@ public extension MaterialAnimation {
*/ */
public static func position(point: CGPoint, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func position(point: CGPoint, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "position") let animation: CABasicAnimation = CABasicAnimation(keyPath: "position")
animation.toValue = NSValue(CGPoint: point) animation.toValue = NSValue(cgPoint: point)
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = AnimationFillModeToValue(mode: .forwards)
animation.removedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
...@@ -290,8 +290,8 @@ public extension MaterialAnimation { ...@@ -290,8 +290,8 @@ public extension MaterialAnimation {
public static func shadowPath(path: CGPath, duration: CFTimeInterval? = nil) -> CABasicAnimation { public static func shadowPath(path: CGPath, duration: CFTimeInterval? = nil) -> CABasicAnimation {
let animation: CABasicAnimation = CABasicAnimation(keyPath: "shadowPath") let animation: CABasicAnimation = CABasicAnimation(keyPath: "shadowPath")
animation.toValue = path animation.toValue = path
animation.fillMode = MaterialAnimationFillModeToValue(.Forwards) animation.fillMode = AnimationFillModeToValue(mode: .forwards)
animation.removedOnCompletion = false animation.isRemovedOnCompletion = false
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
......
...@@ -217,12 +217,12 @@ public class Button: UIButton { ...@@ -217,12 +217,12 @@ public class Button: UIButton {
*/ */
public func pulse(point: CGPoint? = nil) { public func pulse(point: CGPoint? = nil) {
let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point! let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point!
MaterialAnimation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
MaterialAnimation.delay(time: 0.35) { [weak self] in Animation.delay(time: 0.35) { [weak self] in
guard let s = self else { guard let s = self else {
return return
} }
MaterialAnimation.pulseContractAnimation(layer: s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation) Animation.pulseContractAnimation(layer: s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation)
} }
} }
...@@ -234,7 +234,7 @@ public class Button: UIButton { ...@@ -234,7 +234,7 @@ public class Button: UIButton {
*/ */
public override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { public override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event) super.touchesBegan(touches, with: event)
MaterialAnimation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convert(touches.first!.location(in: self), from: layer), width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convert(touches.first!.location(in: self), from: layer), width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
/** /**
...@@ -245,7 +245,7 @@ public class Button: UIButton { ...@@ -245,7 +245,7 @@ public class Button: UIButton {
*/ */
public override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { public override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesEnded(touches, with: event) super.touchesEnded(touches, with: event)
MaterialAnimation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
/** /**
...@@ -256,7 +256,7 @@ public class Button: UIButton { ...@@ -256,7 +256,7 @@ public class Button: UIButton {
*/ */
public override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) { public override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesCancelled(touches, with: event) super.touchesCancelled(touches, with: event)
MaterialAnimation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
/** /**
...@@ -303,7 +303,7 @@ public class Button: UIButton { ...@@ -303,7 +303,7 @@ public class Button: UIButton {
} else if nil == shadowPath { } else if nil == shadowPath {
shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath
} else { } else {
animate(animation: MaterialAnimation.shadowPath(path: UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath, duration: 0)) animate(animation: Animation.shadowPath(path: UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath, duration: 0))
} }
} }
} }
......
...@@ -210,7 +210,7 @@ public class Capture : View, UIGestureRecognizerDelegate { ...@@ -210,7 +210,7 @@ public class Capture : View, UIGestureRecognizerDelegate {
} }
/// Content insert value. /// Content insert value.
public var contentInset: Inset = EdgeInsetsPresetToValue(preset: .square4) { public var contentInset: EdgeInsets = EdgeInsetsPresetToValue(preset: .square4) {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -544,17 +544,26 @@ public class Capture : View, UIGestureRecognizerDelegate { ...@@ -544,17 +544,26 @@ public class Capture : View, UIGestureRecognizerDelegate {
} }
/// Animates the tap and layer. /// Animates the tap and layer.
private func animateTapLayer(layer v: Layer, point: CGPoint) { private func animateTapLayer(layer: Layer, point: CGPoint) {
MaterialAnimation.animationDisabled { Animation.animationDisabled { [weak layer] in
guard let v = layer else {
return
}
v.transform = CATransform3DIdentity v.transform = CATransform3DIdentity
v.position = point v.position = point
v.isHidden = false v.isHidden = false
} }
MaterialAnimation.animateWithDuration(duration: 0.25, animations: { Animation.animateWithDuration(duration: 0.25, animations: { [weak layer] in
guard let v = layer else {
return
}
v.transform = CATransform3DMakeScale(0.5, 0.5, 1) v.transform = CATransform3DMakeScale(0.5, 0.5, 1)
}) { }) {
MaterialAnimation.delay(0.4) { Animation.delay(time: 0.4) { [weak layer] in
MaterialAnimation.animationDisabled { Animation.animationDisabled { [weak layer] in
guard let v = layer else {
return
}
v.isHidden = true v.isHidden = true
} }
} }
......
...@@ -393,7 +393,7 @@ public class Card: PulseView { ...@@ -393,7 +393,7 @@ public class Card: PulseView {
super.prepareView() super.prepareView()
depthPreset = .depth1 depthPreset = .depth1
dividerColor = Color.grey.lighten3 dividerColor = Color.grey.lighten3
cornerRadiusPreset = .Radius1 cornerRadiusPreset = .cornerRadius1
} }
/** /**
......
...@@ -32,28 +32,28 @@ import UIKit ...@@ -32,28 +32,28 @@ import UIKit
public struct Color { public struct Color {
// clear // clear
public static let clear: UIColor = UIColor.clearColor() public static let clear: UIColor = UIColor.clear()
// white // white
public static let white: UIColor = UIColor.whiteColor() public static let white: UIColor = UIColor.white()
// black // black
public static let black: UIColor = UIColor.blackColor() public static let black: UIColor = UIColor.black()
// dark text // dark text
public struct darkText { public struct darkText {
public static let primary: UIColor = Color.black.colorWithAlphaComponent(0.87) public static let primary: UIColor = Color.black.withAlphaComponent(0.87)
public static let secondary: UIColor = Color.black.colorWithAlphaComponent(0.54) public static let secondary: UIColor = Color.black.withAlphaComponent(0.54)
public static let others: UIColor = Color.black.colorWithAlphaComponent(0.38) public static let others: UIColor = Color.black.withAlphaComponent(0.38)
public static let dividers: UIColor = Color.black.colorWithAlphaComponent(0.12) public static let dividers: UIColor = Color.black.withAlphaComponent(0.12)
} }
// light text // light text
public struct lightText { public struct lightText {
public static let primary: UIColor = Color.white public static let primary: UIColor = Color.white
public static let secondary: UIColor = Color.white.colorWithAlphaComponent(0.7) public static let secondary: UIColor = Color.white.withAlphaComponent(0.7)
public static let others: UIColor = Color.white.colorWithAlphaComponent(0.5) public static let others: UIColor = Color.white.withAlphaComponent(0.5)
public static let dividers: UIColor = Color.white.colorWithAlphaComponent(0.12) public static let dividers: UIColor = Color.white.withAlphaComponent(0.12)
} }
// red // red
......
...@@ -41,8 +41,8 @@ public class FabButton: Button { ...@@ -41,8 +41,8 @@ public class FabButton: Button {
public override func prepareView() { public override func prepareView() {
super.prepareView() super.prepareView()
depthPreset = .depth1 depthPreset = .depth1
shape = .circle shapePreset = .circle
pulseAnimation = .CenterWithBacking pulseAnimation = .centerWithBacking
pulseColor = Color.white pulseColor = Color.white
tintColor = Color.white tintColor = Color.white
backgroundColor = Color.red.base backgroundColor = Color.red.base
......
...@@ -40,7 +40,7 @@ public class FlatButton: Button { ...@@ -40,7 +40,7 @@ public class FlatButton: Button {
*/ */
public override func prepareView() { public override func prepareView() {
super.prepareView() super.prepareView()
cornerRadiusPreset = .Radius1 cornerRadiusPreset = .cornerRadius1
contentEdgeInsetsPreset = .wideRectangle3 contentEdgeInsetsPreset = .wideRectangle3
} }
} }
...@@ -40,7 +40,7 @@ public class IconButton: Button { ...@@ -40,7 +40,7 @@ public class IconButton: Button {
*/ */
public override func prepareView() { public override func prepareView() {
super.prepareView() super.prepareView()
cornerRadiusPreset = .Radius1 cornerRadiusPreset = .cornerRadius1
pulseAnimation = .center pulseAnimation = .center
} }
} }
...@@ -534,7 +534,7 @@ public class ImageCard: PulseView { ...@@ -534,7 +534,7 @@ public class ImageCard: PulseView {
super.prepareView() super.prepareView()
depthPreset = .depth1 depthPreset = .depth1
dividerColor = Color.grey.lighten3 dividerColor = Color.grey.lighten3
cornerRadiusPreset = .Radius1 cornerRadiusPreset = .cornerRadius1
} }
/** /**
......
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
public enum AnimationRotationMode {
case none
case auto
case autoReverse
}
/**
:name: AnimationRotationModeToValue
*/
public func AnimationRotationModeToValue(mode: AnimationRotationMode) -> String? {
switch mode {
case .none:
return nil
case .auto:
return kCAAnimationRotateAuto
case .autoReverse:
return kCAAnimationRotateAutoReverse
}
}
public extension Animation {
/**
:name: path
*/
public static func path(bezierPath: UIBezierPath, mode: AnimationRotationMode = .auto, duration: CFTimeInterval? = nil) -> CAKeyframeAnimation {
let animation: CAKeyframeAnimation = CAKeyframeAnimation()
animation.keyPath = "position"
animation.path = bezierPath.cgPath
animation.rotationMode = AnimationRotationModeToValue(mode: mode)
if let v = duration {
animation.duration = v
}
return animation
}
}
...@@ -309,7 +309,7 @@ public class Layer: CAShapeLayer { ...@@ -309,7 +309,7 @@ public class Layer: CAShapeLayer {
- Parameter animation: The currently running CAAnimation instance. - Parameter animation: The currently running CAAnimation instance.
*/ */
public override func animationDidStart(_ animation: CAAnimation) { public override func animationDidStart(_ animation: CAAnimation) {
(delegate as? MaterialAnimationDelegate)?.materialAnimationDidStart?(animation: animation) (delegate as? AnimationDelegate)?.materialAnimationDidStart?(animation: animation)
} }
/** /**
...@@ -330,7 +330,7 @@ public class Layer: CAShapeLayer { ...@@ -330,7 +330,7 @@ public class Layer: CAShapeLayer {
} }
} }
} }
(delegate as? MaterialAnimationDelegate)?.materialAnimationDidStop?(animation: animation, finished: flag) (delegate as? AnimationDelegate)?.materialAnimationDidStop?(animation: animation, finished: flag)
} else if let a: CAAnimationGroup = animation as? CAAnimationGroup { } else if let a: CAAnimationGroup = animation as? CAAnimationGroup {
for x in a.animations! { for x in a.animations! {
animationDidStop(x, finished: true) animationDidStop(x, finished: true)
...@@ -370,7 +370,7 @@ public class Layer: CAShapeLayer { ...@@ -370,7 +370,7 @@ public class Layer: CAShapeLayer {
} else if nil == shadowPath { } else if nil == shadowPath {
shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath
} else { } else {
animate(animation: MaterialAnimation.shadowPath(path: UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath, duration: 0)) animate(animation: Animation.shadowPath(path: UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath, duration: 0))
} }
} }
} }
......
...@@ -118,7 +118,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView { ...@@ -118,7 +118,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
/// A Preset for the contentsGravity property. /// A Preset for the contentsGravity property.
public var contentsGravityPreset: MaterialGravity { public var contentsGravityPreset: MaterialGravity {
didSet { didSet {
contentsGravity = MaterialGravityToValue(contentsGravityPreset) contentsGravity = MaterialGravityToValue(gravity: contentsGravityPreset)
} }
} }
...@@ -133,7 +133,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView { ...@@ -133,7 +133,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
} }
/// A preset wrapper around contentInset. /// A preset wrapper around contentInset.
public var contentEdgeInsetsPreset: Insets { public var contentEdgeInsetsPreset: EdgeInsetsPreset {
get { get {
return grid.contentEdgeInsetsPreset return grid.contentEdgeInsetsPreset
} }
...@@ -153,9 +153,9 @@ public class MaterialCollectionReusableView: UICollectionReusableView { ...@@ -153,9 +153,9 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
} }
/// A preset wrapper around interimSpace. /// A preset wrapper around interimSpace.
public var interimSpacePreset: InterimSpace = .none { public var interimSpacePreset: InterimSpacePreset = .none {
didSet { didSet {
interimSpace = InterimSpacePresetToValue(interimSpacePreset) interimSpace = InterimSpacePresetToValue(preset: interimSpacePreset)
} }
} }
...@@ -208,7 +208,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView { ...@@ -208,7 +208,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
} }
set(value) { set(value) {
layer.frame.size.width = value layer.frame.size.width = value
if .none != shape { if .none != shapePreset {
layer.frame.size.height = value layer.frame.size.height = value
} }
} }
...@@ -226,7 +226,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView { ...@@ -226,7 +226,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
} }
set(value) { set(value) {
layer.frame.size.height = value layer.frame.size.height = value
if .none != shape { if .none != shapePreset {
layer.frame.size.width = value layer.frame.size.width = value
} }
} }
...@@ -310,12 +310,12 @@ public class MaterialCollectionReusableView: UICollectionReusableView { ...@@ -310,12 +310,12 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
*/ */
public func pulse(point: CGPoint? = nil) { public func pulse(point: CGPoint? = nil) {
let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point! let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point!
MaterialAnimation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
MaterialAnimation.delay(time: 0.35) { [weak self] in Animation.delay(time: 0.35) { [weak self] in
guard let s = self else { guard let s = self else {
return return
} }
MaterialAnimation.pulseContractAnimation(layer: s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation) Animation.pulseContractAnimation(layer: s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation)
} }
} }
...@@ -327,7 +327,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView { ...@@ -327,7 +327,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
*/ */
public override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { public override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event) super.touchesBegan(touches, with: event)
MaterialAnimation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convert(touches.first!.location(in: self), from: layer), width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convert(touches.first!.location(in: self), from: layer), width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
/** /**
...@@ -338,7 +338,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView { ...@@ -338,7 +338,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
*/ */
public override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { public override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesEnded(touches, with: event) super.touchesEnded(touches, with: event)
MaterialAnimation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
/** /**
...@@ -349,7 +349,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView { ...@@ -349,7 +349,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
*/ */
public override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) { public override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesCancelled(touches, with: event) super.touchesCancelled(touches, with: event)
MaterialAnimation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
/** /**
...@@ -396,7 +396,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView { ...@@ -396,7 +396,7 @@ public class MaterialCollectionReusableView: UICollectionReusableView {
} else if nil == shadowPath { } else if nil == shadowPath {
shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath
} else { } else {
animate(animation: MaterialAnimation.shadowPath(path: UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath, duration: 0)) animate(animation: Animation.shadowPath(path: UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath, duration: 0))
} }
} }
} }
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
import UIKit import UIKit
@IBDesignable @IBDesignable
public class MaterialCollectionView : UICollectionView { public class MaterialCollectionView: UICollectionView {
/// A property that accesses the layer.frame.origin.x property. /// A property that accesses the layer.frame.origin.x property.
@IBInspectable public var x: CGFloat { @IBInspectable public var x: CGFloat {
get { get {
...@@ -73,12 +73,12 @@ public class MaterialCollectionView : UICollectionView { ...@@ -73,12 +73,12 @@ public class MaterialCollectionView : UICollectionView {
} }
/// A preset wrapper around contentInset. /// A preset wrapper around contentInset.
public var contentEdgeInsetsPreset: Insets { public var contentEdgeInsetsPreset: EdgeInsets {
get { get {
return (collectionViewLayout as? MaterialCollectionViewLayout)!.contentEdgeInsetsPreset return (collectionViewLayout as? MaterialCollectionViewLayout)!.contentInset
} }
set(value) { set(value) {
(collectionViewLayout as? MaterialCollectionViewLayout)!.contentEdgeInsetsPreset = value (collectionViewLayout as? MaterialCollectionViewLayout)!.contentInset = value
} }
} }
...@@ -102,9 +102,9 @@ public class MaterialCollectionView : UICollectionView { ...@@ -102,9 +102,9 @@ public class MaterialCollectionView : UICollectionView {
} }
/// A preset wrapper around interimSpace. /// A preset wrapper around interimSpace.
public var interimSpacePreset: InterimSpace = .none { public var interimSpacePreset: InterimSpacePreset = .none {
didSet { didSet {
interimSpace = InterimSpacePresetToValue(interimSpacePreset) interimSpace = InterimSpacePresetToValue(preset: interimSpacePreset)
} }
} }
......
...@@ -118,7 +118,7 @@ public class MaterialCollectionViewCell: UICollectionViewCell { ...@@ -118,7 +118,7 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
/// A Preset for the contentsGravity property. /// A Preset for the contentsGravity property.
public var contentsGravityPreset: MaterialGravity { public var contentsGravityPreset: MaterialGravity {
didSet { didSet {
contentsGravity = MaterialGravityToValue(contentsGravityPreset) contentsGravity = MaterialGravityToValue(gravity: contentsGravityPreset)
} }
} }
...@@ -153,9 +153,9 @@ public class MaterialCollectionViewCell: UICollectionViewCell { ...@@ -153,9 +153,9 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
} }
/// A preset wrapper around interimSpace. /// A preset wrapper around interimSpace.
public var interimSpacePreset: InterimSpace = .none { public var interimSpacePreset: InterimSpacePreset = .none {
didSet { didSet {
interimSpace = InterimSpacePresetToValue(interimSpacePreset) interimSpace = InterimSpacePresetToValue(preset: interimSpacePreset)
} }
} }
...@@ -290,8 +290,8 @@ public class MaterialCollectionViewCell: UICollectionViewCell { ...@@ -290,8 +290,8 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
self.init(frame: CGRect.zero) self.init(frame: CGRect.zero)
} }
public override func layoutSublayersOfLayer(layer: CALayer) { public override func layoutSublayers(of layer: CALayer) {
super.layoutSublayersOfLayer(layer) super.layoutSublayers(of: layer)
if self.layer == layer { if self.layer == layer {
layoutShape() layoutShape()
layoutVisualLayer() layoutVisualLayer()
...@@ -310,12 +310,12 @@ public class MaterialCollectionViewCell: UICollectionViewCell { ...@@ -310,12 +310,12 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
*/ */
public func pulse(point: CGPoint? = nil) { public func pulse(point: CGPoint? = nil) {
let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point! let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point!
MaterialAnimation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
MaterialAnimation.delay(time: 0.35) { [weak self] in Animation.delay(time: 0.35) { [weak self] in
guard let s = self else { guard let s = self else {
return return
} }
MaterialAnimation.pulseContractAnimation(layer: s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation) Animation.pulseContractAnimation(layer: s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation)
} }
} }
...@@ -327,7 +327,7 @@ public class MaterialCollectionViewCell: UICollectionViewCell { ...@@ -327,7 +327,7 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
*/ */
public override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { public override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event) super.touchesBegan(touches, with: event)
MaterialAnimation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convert(touches.first!.location(in: self), from: layer), width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convert(touches.first!.location(in: self), from: layer), width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
/** /**
...@@ -338,7 +338,7 @@ public class MaterialCollectionViewCell: UICollectionViewCell { ...@@ -338,7 +338,7 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
*/ */
public override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { public override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesEnded(touches, with: event) super.touchesEnded(touches, with: event)
MaterialAnimation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
/** /**
...@@ -349,7 +349,7 @@ public class MaterialCollectionViewCell: UICollectionViewCell { ...@@ -349,7 +349,7 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
*/ */
public override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) { public override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesCancelled(touches, with: event) super.touchesCancelled(touches, with: event)
MaterialAnimation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
/** /**
...@@ -390,12 +390,12 @@ public class MaterialCollectionViewCell: UICollectionViewCell { ...@@ -390,12 +390,12 @@ public class MaterialCollectionViewCell: UICollectionViewCell {
/// Sets the shadow path. /// Sets the shadow path.
internal func layoutShadowPath() { internal func layoutShadowPath() {
if shadowPathAutoSizeEnabled { if shadowPathAutoSizeEnabled {
if .none == depth { if .none == depthPreset {
shadowPath = nil shadowPath = nil
} else if nil == shadowPath { } else if nil == shadowPath {
shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).CGPath shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath
} else { } else {
animate(MaterialAnimation.shadowPath(UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).CGPath, duration: 0)) animate(animation: Animation.shadowPath(path: UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath, duration: 0))
} }
} }
} }
......
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
import UIKit import UIKit
public protocol MaterialCollectionViewDataSource : UICollectionViewDataSource { public protocol MaterialCollectionViewDataSource: UICollectionViewDataSource {
/** /**
Retrieves the items for the collectionView. Retrieves the items for the collectionView.
- Returns: An Array of Arrays of MaterialDataSourceItem objects. - Returns: An Array of Arrays of MaterialDataSourceItem objects.
*/ */
func items() -> Array<MaterialDataSourceItem> func items() -> [MaterialDataSourceItem]
} }
...@@ -30,6 +30,6 @@ ...@@ -30,6 +30,6 @@
import UIKit import UIKit
public protocol MaterialCollectionViewDelegate : MaterialDelegate, UICollectionViewDelegate { public protocol MaterialCollectionViewDelegate: MaterialDelegate, UICollectionViewDelegate {
} }
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
import UIKit import UIKit
public class MaterialCollectionViewLayout : UICollectionViewLayout { public class MaterialCollectionViewLayout: UICollectionViewLayout {
/// Used to calculate the dimensions of the cells. /// Used to calculate the dimensions of the cells.
internal var offset: CGPoint = CGPoint.zero internal var offset: CGPoint = CGPoint.zero
......
...@@ -165,12 +165,12 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -165,12 +165,12 @@ public class MaterialTableViewCell: UITableViewCell {
*/ */
public func pulse(point: CGPoint? = nil) { public func pulse(point: CGPoint? = nil) {
let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point! let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point!
MaterialAnimation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
MaterialAnimation.delay(time: 0.35) { [weak self] in Animation.delay(time: 0.35) { [weak self] in
guard let s = self else { guard let s = self else {
return return
} }
MaterialAnimation.pulseContractAnimation(layer: s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation) Animation.pulseContractAnimation(layer: s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation)
} }
} }
...@@ -182,7 +182,7 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -182,7 +182,7 @@ public class MaterialTableViewCell: UITableViewCell {
*/ */
public override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { public override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event) super.touchesBegan(touches, with: event)
MaterialAnimation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convert(touches.first!.location(in: self), from: layer), width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convert(touches.first!.location(in: self), from: layer), width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
/** /**
...@@ -193,7 +193,7 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -193,7 +193,7 @@ public class MaterialTableViewCell: UITableViewCell {
*/ */
public override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { public override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesEnded(touches, with: event) super.touchesEnded(touches, with: event)
MaterialAnimation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
/** /**
...@@ -204,7 +204,7 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -204,7 +204,7 @@ public class MaterialTableViewCell: UITableViewCell {
*/ */
public override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) { public override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesCancelled(touches, with: event) super.touchesCancelled(touches, with: event)
MaterialAnimation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
/** /**
...@@ -243,9 +243,9 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -243,9 +243,9 @@ public class MaterialTableViewCell: UITableViewCell {
if .none == depth { if .none == depth {
shadowPath = nil shadowPath = nil
} else if nil == shadowPath { } else if nil == shadowPath {
shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).CGPath shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath
} else { } else {
animate(MaterialAnimation.shadowPath(UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).CGPath, duration: 0)) animate(Animation.shadowPath(UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath, duration: 0))
} }
} }
} }
......
...@@ -40,7 +40,7 @@ public enum PulseAnimation { ...@@ -40,7 +40,7 @@ public enum PulseAnimation {
case pointWithBacking case pointWithBacking
} }
internal extension MaterialAnimation { internal extension Animation {
/** /**
Triggers the expanding animation. Triggers the expanding animation.
- Parameter layer: Container CALayer. - Parameter layer: Container CALayer.
...@@ -66,7 +66,7 @@ internal extension MaterialAnimation { ...@@ -66,7 +66,7 @@ internal extension MaterialAnimation {
pulseLayers.insert(bLayer, at: 0) pulseLayers.insert(bLayer, at: 0)
visualLayer.addSublayer(bLayer) visualLayer.addSublayer(bLayer)
MaterialAnimation.animationDisabled(animations: { Animation.animationDisabled(animations: {
bLayer.frame = visualLayer.bounds bLayer.frame = visualLayer.bounds
pLayer.bounds = CGRect(x: 0, y: 0, width: n, height: n) pLayer.bounds = CGRect(x: 0, y: 0, width: n, height: n)
...@@ -88,19 +88,19 @@ internal extension MaterialAnimation { ...@@ -88,19 +88,19 @@ internal extension MaterialAnimation {
switch pulseAnimation { switch pulseAnimation {
case .centerWithBacking, .backing, .pointWithBacking: case .centerWithBacking, .backing, .pointWithBacking:
bLayer.add(MaterialAnimation.backgroundColor(color: pulseColor.withAlphaComponent(pulseOpacity / 2), duration: duration), forKey: nil) bLayer.add(Animation.backgroundColor(color: pulseColor.withAlphaComponent(pulseOpacity / 2), duration: duration), forKey: nil)
default:break default:break
} }
switch pulseAnimation { switch pulseAnimation {
case .center, .centerWithBacking, .centerRadialBeyondBounds, .point, .pointWithBacking: case .center, .centerWithBacking, .centerRadialBeyondBounds, .point, .pointWithBacking:
pLayer.add(MaterialAnimation.scale(scale: 1, duration: duration), forKey: nil) pLayer.add(Animation.scale(scale: 1, duration: duration), forKey: nil)
default:break default:break
} }
MaterialAnimation.delay(time: duration, completion: { Animation.delay(time: duration) {
bLayer.setValue(true, forKey: "animated") bLayer.setValue(true, forKey: "animated")
}) }
} }
/** /**
...@@ -114,31 +114,35 @@ internal extension MaterialAnimation { ...@@ -114,31 +114,35 @@ internal extension MaterialAnimation {
return return
} }
let animated: Bool? = bLayer.value(forKey: "animated") as? Bool guard let animated = bLayer.value(forKey: "animated") as? Bool else {
return
}
Animation.delay(time: animated ? 0 : 0.15) {
guard let pLayer: CAShapeLayer = bLayer.sublayers?.first as? CAShapeLayer else {
return
}
MaterialAnimation.delay(time: true == animated ? 0 : 0.15) { let duration = 0.325
if let pLayer: CAShapeLayer = bLayer.sublayers?.first as? CAShapeLayer {
let duration: CFTimeInterval = 0.325
switch pulseAnimation { switch pulseAnimation {
case .centerWithBacking, .backing, .pointWithBacking: case .centerWithBacking, .backing, .pointWithBacking:
bLayer.add(MaterialAnimation.backgroundColor(color: pulseColor.withAlphaComponent(0), duration: 0.325), forKey: nil) bLayer.add(Animation.backgroundColor(color: pulseColor.withAlphaComponent(0), duration: duration), forKey: nil)
default:break default:break
} }
switch pulseAnimation { switch pulseAnimation {
case .center, .centerWithBacking, .centerRadialBeyondBounds, .point, .pointWithBacking: case .center, .centerWithBacking, .centerRadialBeyondBounds, .point, .pointWithBacking:
pLayer.addAnimation(MaterialAnimation.animationGroup(animations: [ pLayer.add(Animation.animationGroup(animations: [
MaterialAnimation.scale(scale: .Center == pulseAnimation ? 1 : 1.325), Animation.scale(scale: .center == pulseAnimation ? 1 : 1.325),
MaterialAnimation.backgroundColor(pulseColor.colorWithAlphaComponent(0)) Animation.backgroundColor(color: pulseColor.withAlphaComponent(0))
], duration: duration), forKey: nil) ], duration: duration), forKey: nil)
default:break default:break
} }
MaterialAnimation.delay(time: duration, completion: { Animation.delay(time: duration) {
pLayer.removeFromSuperlayer() pLayer.removeFromSuperlayer()
bLayer.removeFromSuperlayer() bLayer.removeFromSuperlayer()
})
} }
} }
} }
......
...@@ -54,12 +54,12 @@ public class PulseView: View { ...@@ -54,12 +54,12 @@ public class PulseView: View {
*/ */
public func pulse(point: CGPoint? = nil) { public func pulse(point: CGPoint? = nil) {
let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point! let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point!
MaterialAnimation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
MaterialAnimation.delay(time: 0.35) { [weak self] in Animation.delay(time: 0.35) { [weak self] in
guard let s = self else { guard let s = self else {
return return
} }
MaterialAnimation.pulseContractAnimation(layer: s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation) Animation.pulseContractAnimation(layer: s.layer, visualLayer: s.visualLayer, pulseColor: s.pulseColor, pulseLayers: &s.pulseLayers, pulseAnimation: s.pulseAnimation)
} }
} }
...@@ -71,7 +71,7 @@ public class PulseView: View { ...@@ -71,7 +71,7 @@ public class PulseView: View {
*/ */
public override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { public override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event) super.touchesBegan(touches, with: event)
MaterialAnimation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convert(touches.first!.location(in: self), from: layer), width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: layer.convert(touches.first!.location(in: self), from: layer), width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
/** /**
...@@ -82,7 +82,7 @@ public class PulseView: View { ...@@ -82,7 +82,7 @@ public class PulseView: View {
*/ */
public override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { public override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesEnded(touches, with: event) super.touchesEnded(touches, with: event)
MaterialAnimation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
/** /**
...@@ -93,6 +93,6 @@ public class PulseView: View { ...@@ -93,6 +93,6 @@ public class PulseView: View {
*/ */
public override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) { public override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesCancelled(touches, with: event) super.touchesCancelled(touches, with: event)
MaterialAnimation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
} }
} }
...@@ -41,7 +41,7 @@ public class RaisedButton: Button { ...@@ -41,7 +41,7 @@ public class RaisedButton: Button {
public override func prepareView() { public override func prepareView() {
super.prepareView() super.prepareView()
depthPreset = .depth1 depthPreset = .depth1
cornerRadiusPreset = .Radius1 cornerRadiusPreset = .cornerRadius1
contentEdgeInsetsPreset = .wideRectangle3 contentEdgeInsetsPreset = .wideRectangle3
backgroundColor = Color.white backgroundColor = Color.white
} }
......
...@@ -247,9 +247,9 @@ public class TextView: UITextView { ...@@ -247,9 +247,9 @@ public class TextView: UITextView {
if .none == depth { if .none == depth {
shadowPath = nil shadowPath = nil
} else if nil == shadowPath { } else if nil == shadowPath {
shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).CGPath shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath
} else { } else {
animate(MaterialAnimation.shadowPath(UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).CGPath, duration: 0)) animate(Animation.shadowPath(UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath, duration: 0))
} }
} }
} }
......
...@@ -30,17 +30,17 @@ ...@@ -30,17 +30,17 @@
import UIKit import UIKit
public typealias MaterialAnimationTransitionType = String public typealias AnimationTransitionType = String
public typealias MaterialAnimationTransitionSubTypeType = String public typealias AnimationTransitionSubTypeType = String
public enum MaterialAnimationTransition { public enum AnimationTransition {
case Fade case Fade
case MoveIn case MoveIn
case Push case Push
case Reveal case Reveal
} }
public enum MaterialAnimationTransitionSubType { public enum AnimationTransitionSubType {
case Right case Right
case Left case Left
case Top case Top
...@@ -48,9 +48,9 @@ public enum MaterialAnimationTransitionSubType { ...@@ -48,9 +48,9 @@ public enum MaterialAnimationTransitionSubType {
} }
/** /**
:name: MaterialAnimationTransitionToValue :name: AnimationTransitionToValue
*/ */
public func MaterialAnimationTransitionToValue(transition: MaterialAnimationTransition) -> MaterialAnimationTransitionType { public func AnimationTransitionToValue(transition: AnimationTransition) -> AnimationTransitionType {
switch transition { switch transition {
case .Fade: case .Fade:
return kCATransitionFade return kCATransitionFade
...@@ -64,9 +64,9 @@ public func MaterialAnimationTransitionToValue(transition: MaterialAnimationTran ...@@ -64,9 +64,9 @@ public func MaterialAnimationTransitionToValue(transition: MaterialAnimationTran
} }
/** /**
:name: MaterialAnimationTransitionSubTypeToValue :name: AnimationTransitionSubTypeToValue
*/ */
public func MaterialAnimationTransitionSubTypeToValue(direction: MaterialAnimationTransitionSubType) -> MaterialAnimationTransitionSubTypeType { public func AnimationTransitionSubTypeToValue(direction: AnimationTransitionSubType) -> AnimationTransitionSubTypeType {
switch direction { switch direction {
case .Right: case .Right:
return kCATransitionFromRight return kCATransitionFromRight
...@@ -79,15 +79,15 @@ public func MaterialAnimationTransitionSubTypeToValue(direction: MaterialAnimati ...@@ -79,15 +79,15 @@ public func MaterialAnimationTransitionSubTypeToValue(direction: MaterialAnimati
} }
} }
public extension MaterialAnimation { public extension Animation {
/** /**
:name: transition :name: transition
*/ */
public static func transition(type: MaterialAnimationTransition, direction: MaterialAnimationTransitionSubType? = nil, duration: CFTimeInterval? = nil) -> CATransition { public static func transition(type: AnimationTransition, direction: AnimationTransitionSubType? = nil, duration: CFTimeInterval? = nil) -> CATransition {
let animation: CATransition = CATransition() let animation: CATransition = CATransition()
animation.type = MaterialAnimationTransitionToValue(type) animation.type = AnimationTransitionToValue(transition: type)
if let d = direction { if let d = direction {
animation.subtype = MaterialAnimationTransitionSubTypeToValue(d) animation.subtype = AnimationTransitionSubTypeToValue(direction: d)
} }
if let v: CFTimeInterval = duration { if let v: CFTimeInterval = duration {
animation.duration = v animation.duration = v
......
...@@ -302,7 +302,7 @@ public class View: UIView { ...@@ -302,7 +302,7 @@ public class View: UIView {
} else if nil == shadowPath { } else if nil == shadowPath {
shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath
} else { } else {
animate(animation: MaterialAnimation.shadowPath(path: UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath, duration: 0)) animate(animation: Animation.shadowPath(path: UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath, duration: 0))
} }
} }
} }
......
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