Commit cf9d270f by Daniel Dahan

added @IBInspectable where appropriate

parent 7eb6d70c
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
963236121C96512C00282A94 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 963236111C96512C00282A94 /* Material.framework */; };
963236131C96512C00282A94 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 963236111C96512C00282A94 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9663F9321C7A744600AF0965 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9311C7A744600AF0965 /* AppDelegate.swift */; }; 9663F9321C7A744600AF0965 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9311C7A744600AF0965 /* AppDelegate.swift */; };
9663F9341C7A744600AF0965 /* RecommendationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9331C7A744600AF0965 /* RecommendationViewController.swift */; }; 9663F9341C7A744600AF0965 /* RecommendationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9331C7A744600AF0965 /* RecommendationViewController.swift */; };
9663F9391C7A744600AF0965 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9663F9381C7A744600AF0965 /* Assets.xcassets */; }; 9663F9391C7A744600AF0965 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9663F9381C7A744600AF0965 /* Assets.xcassets */; };
...@@ -17,8 +19,6 @@ ...@@ -17,8 +19,6 @@
9663F94E1C7A74EA00AF0965 /* AppLeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */; }; 9663F94E1C7A74EA00AF0965 /* AppLeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */; };
9663F9501C7A74FC00AF0965 /* AppRightViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F94F1C7A74FC00AF0965 /* AppRightViewController.swift */; }; 9663F9501C7A74FC00AF0965 /* AppRightViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F94F1C7A74FC00AF0965 /* AppRightViewController.swift */; };
9663F9521C7A751D00AF0965 /* ItemViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9511C7A751D00AF0965 /* ItemViewController.swift */; }; 9663F9521C7A751D00AF0965 /* ItemViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9511C7A751D00AF0965 /* ItemViewController.swift */; };
968F171F1C9273ED008CA3F6 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 968F171E1C9273ED008CA3F6 /* Material.framework */; };
968F17201C9273ED008CA3F6 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 968F171E1C9273ED008CA3F6 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
96CC08881C7FEBD60034FF84 /* RecipesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */; }; 96CC08881C7FEBD60034FF84 /* RecipesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
968F17201C9273ED008CA3F6 /* Material.framework in Embed Frameworks */, 963236131C96512C00282A94 /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
963236111C96512C00282A94 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
9663F92E1C7A744600AF0965 /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; }; 9663F92E1C7A744600AF0965 /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; };
9663F9311C7A744600AF0965 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 9663F9311C7A744600AF0965 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
9663F9331C7A744600AF0965 /* RecommendationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecommendationViewController.swift; sourceTree = "<group>"; }; 9663F9331C7A744600AF0965 /* RecommendationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecommendationViewController.swift; sourceTree = "<group>"; };
...@@ -49,7 +50,6 @@ ...@@ -49,7 +50,6 @@
9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppLeftViewController.swift; sourceTree = "<group>"; }; 9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppLeftViewController.swift; sourceTree = "<group>"; };
9663F94F1C7A74FC00AF0965 /* AppRightViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppRightViewController.swift; sourceTree = "<group>"; }; 9663F94F1C7A74FC00AF0965 /* AppRightViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppRightViewController.swift; sourceTree = "<group>"; };
9663F9511C7A751D00AF0965 /* ItemViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemViewController.swift; sourceTree = "<group>"; }; 9663F9511C7A751D00AF0965 /* ItemViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemViewController.swift; sourceTree = "<group>"; };
968F171E1C9273ED008CA3F6 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecipesViewController.swift; sourceTree = "<group>"; }; 96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecipesViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
968F171F1C9273ED008CA3F6 /* Material.framework in Frameworks */, 963236121C96512C00282A94 /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
9663F9251C7A744500AF0965 = { 9663F9251C7A744500AF0965 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
968F171E1C9273ED008CA3F6 /* Material.framework */, 963236111C96512C00282A94 /* Material.framework */,
9663F9301C7A744600AF0965 /* App */, 9663F9301C7A744600AF0965 /* App */,
9663F92F1C7A744600AF0965 /* Products */, 9663F92F1C7A744600AF0965 /* Products */,
); );
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
96212DCB1C1696D000F31053 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96212DC31C1696D000F31053 /* LaunchScreen.storyboard */; }; 96212DCB1C1696D000F31053 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96212DC31C1696D000F31053 /* LaunchScreen.storyboard */; };
96212DCC1C1696D000F31053 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96212DC51C1696D000F31053 /* Main.storyboard */; }; 96212DCC1C1696D000F31053 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96212DC51C1696D000F31053 /* Main.storyboard */; };
96212DCE1C1696D000F31053 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96212DC81C1696D000F31053 /* ViewController.swift */; }; 96212DCE1C1696D000F31053 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96212DC81C1696D000F31053 /* ViewController.swift */; };
963236151C96578E00282A94 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 963236141C96578E00282A94 /* Material.framework */; };
963236161C96578E00282A94 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 963236141C96578E00282A94 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */ /* Begin PBXCopyFilesBuildPhase section */
...@@ -21,6 +23,7 @@ ...@@ -21,6 +23,7 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
963236161C96578E00282A94 /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -34,6 +37,7 @@ ...@@ -34,6 +37,7 @@
96212DC61C1696D000F31053 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; 96212DC61C1696D000F31053 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
96212DC71C1696D000F31053 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 96212DC71C1696D000F31053 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
96212DC81C1696D000F31053 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; 96212DC81C1696D000F31053 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
963236141C96578E00282A94 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-hbpnflxhoouqxebjcyhbbhqyesjd/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
9ABEC4EF1C14F08200F6895E /* MaterialPulseView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MaterialPulseView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 9ABEC4EF1C14F08200F6895E /* MaterialPulseView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MaterialPulseView.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */ /* End PBXFileReference section */
...@@ -42,6 +46,7 @@ ...@@ -42,6 +46,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
963236151C96578E00282A94 /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -64,6 +69,7 @@ ...@@ -64,6 +69,7 @@
9ABEC4E61C14F08200F6895E = { 9ABEC4E61C14F08200F6895E = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
963236141C96578E00282A94 /* Material.framework */,
96212DC01C1696D000F31053 /* MaterialPulseView */, 96212DC01C1696D000F31053 /* MaterialPulseView */,
9ABEC4F01C14F08200F6895E /* Products */, 9ABEC4F01C14F08200F6895E /* Products */,
); );
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
</dependencies> </dependencies>
<scenes> <scenes>
<!--View Controller--> <!--View Controller-->
...@@ -19,15 +19,16 @@ ...@@ -19,15 +19,16 @@
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zN4-ul-wPl" customClass="MaterialPulseView" customModule="Material"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zN4-ul-wPl" customClass="MaterialPulseView" customModule="Material">
<rect key="frame" x="200" y="200" width="200" height="200"/> <rect key="frame" x="200" y="200" width="200" height="200"/>
<animations/>
<color key="backgroundColor" red="0.39222975830000001" green="0.2440954615" blue="0.68699765469999996" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" red="0.39222975830000001" green="0.2440954615" blue="0.68699765469999996" alpha="1" colorSpace="calibratedRGB"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="200" id="Dz1-jZ-jhl"/> <constraint firstAttribute="width" constant="200" id="Dz1-jZ-jhl"/>
<constraint firstAttribute="height" constant="200" id="HWq-yF-e3p"/> <constraint firstAttribute="height" constant="200" id="HWq-yF-e3p"/>
</constraints> </constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="image" keyPath="image" value="ContentAppIcon"/>
</userDefinedRuntimeAttributes>
</view> </view>
</subviews> </subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints> <constraints>
<constraint firstItem="zN4-ul-wPl" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="2rl-2s-lQp"/> <constraint firstItem="zN4-ul-wPl" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="2rl-2s-lQp"/>
...@@ -43,4 +44,7 @@ ...@@ -43,4 +44,7 @@
<point key="canvasLocation" x="286" y="363"/> <point key="canvasLocation" x="286" y="363"/>
</scene> </scene>
</scenes> </scenes>
<resources>
<image name="ContentAppIcon" width="1024" height="1024"/>
</resources>
</document> </document>
...@@ -37,25 +37,16 @@ class ViewController: UIViewController { ...@@ -37,25 +37,16 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareMaterialPulseView()
// Examples of using MaterialPulseView.
prepareGeneralMaterialPulseViewExample()
} }
/** /// General preparation statements.
:name: prepareView
:description: General preparation statements.
*/
private func prepareView() { private func prepareView() {
view.backgroundColor = MaterialColor.white view.backgroundColor = MaterialColor.white
} }
/** /// Prepares the pulseView.
:name: prepareGeneralMaterialPulseViewExample private func prepareMaterialPulseView() {
:description: General usage example.
*/
private func prepareGeneralMaterialPulseViewExample() {
pulseView.image = UIImage(named: "ContentAppIcon")
pulseView.shape = .Circle pulseView.shape = .Circle
pulseView.depth = .Depth2 pulseView.depth = .Depth2
} }
......
...@@ -489,9 +489,9 @@ ...@@ -489,9 +489,9 @@
96D88C4D1C1329BB00B91418 /* Animation */ = { 96D88C4D1C1329BB00B91418 /* Animation */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96D88C131C1328D800B91418 /* MaterialTransitionAnimation.swift */,
96D88BFF1C1328D800B91418 /* MaterialAnimation.swift */, 96D88BFF1C1328D800B91418 /* MaterialAnimation.swift */,
96D88C001C1328D800B91418 /* MaterialBasicAnimation.swift */, 96D88C001C1328D800B91418 /* MaterialBasicAnimation.swift */,
96D88C131C1328D800B91418 /* MaterialTransitionAnimation.swift */,
96D88C081C1328D800B91418 /* MaterialKeyframeAnimation.swift */, 96D88C081C1328D800B91418 /* MaterialKeyframeAnimation.swift */,
968F17211C94B10B008CA3F6 /* MaterialPulseAnimation.swift */, 968F17211C94B10B008CA3F6 /* MaterialPulseAnimation.swift */,
); );
......
...@@ -123,7 +123,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate { ...@@ -123,7 +123,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
/** /**
:name: tapToFocusEnabled :name: tapToFocusEnabled
*/ */
public var tapToFocusEnabled: Bool = false { @IBInspectable public var tapToFocusEnabled: Bool = false {
didSet { didSet {
if tapToFocusEnabled { if tapToFocusEnabled {
tapToResetEnabled = true tapToResetEnabled = true
...@@ -143,7 +143,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate { ...@@ -143,7 +143,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
/** /**
:name: tapToExposeEnabled :name: tapToExposeEnabled
*/ */
public var tapToExposeEnabled: Bool = false { @IBInspectable public var tapToExposeEnabled: Bool = false {
didSet { didSet {
if tapToExposeEnabled { if tapToExposeEnabled {
tapToResetEnabled = true tapToResetEnabled = true
...@@ -163,7 +163,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate { ...@@ -163,7 +163,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
/** /**
:name: tapToResetEnabled :name: tapToResetEnabled
*/ */
public var tapToResetEnabled: Bool = false { @IBInspectable public var tapToResetEnabled: Bool = false {
didSet { didSet {
if tapToResetEnabled { if tapToResetEnabled {
prepareResetLayer() prepareResetLayer()
......
...@@ -39,7 +39,7 @@ public class CardView : MaterialPulseView { ...@@ -39,7 +39,7 @@ public class CardView : MaterialPulseView {
/** /**
:name: dividerColor :name: dividerColor
*/ */
public var dividerColor: UIColor? { @IBInspectable public var dividerColor: UIColor? {
didSet { didSet {
dividerLayer?.backgroundColor = dividerColor?.CGColor dividerLayer?.backgroundColor = dividerColor?.CGColor
} }
...@@ -48,7 +48,7 @@ public class CardView : MaterialPulseView { ...@@ -48,7 +48,7 @@ public class CardView : MaterialPulseView {
/** /**
:name: divider :name: divider
*/ */
public var divider: Bool = true { @IBInspectable public var divider: Bool = true {
didSet { didSet {
reloadView() reloadView()
} }
......
...@@ -64,7 +64,7 @@ public class ControlView : MaterialView { ...@@ -64,7 +64,7 @@ public class ControlView : MaterialView {
} }
/// A wrapper around grid.spacing. /// A wrapper around grid.spacing.
public var spacing: CGFloat { @IBInspectable public var spacing: CGFloat {
get { get {
return grid.spacing return grid.spacing
} }
......
...@@ -39,7 +39,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -39,7 +39,7 @@ public class ImageCardView : MaterialPulseView {
/** /**
:name: dividerColor :name: dividerColor
*/ */
public var dividerColor: UIColor? { @IBInspectable public var dividerColor: UIColor? {
didSet { didSet {
dividerLayer?.backgroundColor = dividerColor?.CGColor dividerLayer?.backgroundColor = dividerColor?.CGColor
} }
...@@ -48,7 +48,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -48,7 +48,7 @@ public class ImageCardView : MaterialPulseView {
/** /**
:name: divider :name: divider
*/ */
public var divider: Bool = true { @IBInspectable public var divider: Bool = true {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -80,7 +80,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -80,7 +80,7 @@ public class ImageCardView : MaterialPulseView {
/** /**
:name: image :name: image
*/ */
public override var image: UIImage? { @IBInspectable public override var image: UIImage? {
get { get {
return nil == imageLayer?.contents ? nil : UIImage(CGImage: imageLayer?.contents as! CGImage) return nil == imageLayer?.contents ? nil : UIImage(CGImage: imageLayer?.contents as! CGImage)
} }
...@@ -108,7 +108,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -108,7 +108,7 @@ public class ImageCardView : MaterialPulseView {
/** /**
:name: maxImageHeight :name: maxImageHeight
*/ */
public var maxImageHeight: CGFloat = 0 { @IBInspectable public var maxImageHeight: CGFloat = 0 {
didSet { didSet {
if let v: UIImage = image { if let v: UIImage = image {
if 0 < maxImageHeight { if 0 < maxImageHeight {
...@@ -147,7 +147,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -147,7 +147,7 @@ public class ImageCardView : MaterialPulseView {
/** /**
:name: contentsScale :name: contentsScale
*/ */
public override var contentsScale: CGFloat { @IBInspectable public override var contentsScale: CGFloat {
didSet { didSet {
prepareImageLayer() prepareImageLayer()
imageLayer?.contentsScale = contentsScale imageLayer?.contentsScale = contentsScale
...@@ -155,7 +155,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -155,7 +155,7 @@ public class ImageCardView : MaterialPulseView {
} }
/// Determines how content should be aligned within the visualLayer's bounds. /// Determines how content should be aligned within the visualLayer's bounds.
public override var contentsGravity: String { @IBInspectable public override var contentsGravity: String {
get { get {
return nil == imageLayer ? "" : imageLayer!.contentsGravity return nil == imageLayer ? "" : imageLayer!.contentsGravity
} }
......
...@@ -45,14 +45,20 @@ public class MaterialButton : UIButton { ...@@ -45,14 +45,20 @@ public class MaterialButton : UIButton {
*/ */
public weak var delegate: MaterialDelegate? public weak var delegate: MaterialDelegate?
/// To use a single pulse and have it focused when held.
@IBInspectable public var pulseFocus: Bool = false
/// A pulse layer for focus handling.
public private(set) var pulseLayer: CAShapeLayer?
/// Sets whether the scaling animation should be used. /// Sets whether the scaling animation should be used.
public lazy var pulseScale: Bool = true @IBInspectable public lazy var pulseScale: Bool = true
/// The opcaity value for the pulse animation. /// The opcaity value for the pulse animation.
public var pulseColorOpacity: CGFloat = 0.25 @IBInspectable public var pulseOpacity: CGFloat = 0.25
/// The color of the pulse effect. /// The color of the pulse effect.
public var pulseColor: UIColor? @IBInspectable public var pulseColor: UIColor?
/** /**
This property is the same as clipsToBounds. It crops any of the view's This property is the same as clipsToBounds. It crops any of the view's
...@@ -60,7 +66,7 @@ public class MaterialButton : UIButton { ...@@ -60,7 +66,7 @@ public class MaterialButton : UIButton {
the image property, then this value does not need to be set, since the the image property, then this value does not need to be set, since the
visualLayer's maskToBounds is set to true by default. visualLayer's maskToBounds is set to true by default.
*/ */
public var masksToBounds: Bool { @IBInspectable public var masksToBounds: Bool {
get { get {
return layer.masksToBounds return layer.masksToBounds
} }
...@@ -70,14 +76,14 @@ public class MaterialButton : UIButton { ...@@ -70,14 +76,14 @@ public class MaterialButton : UIButton {
} }
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's backgroundColor.
public override var backgroundColor: UIColor? { @IBInspectable public override var backgroundColor: UIColor? {
didSet { didSet {
layer.backgroundColor = backgroundColor?.CGColor layer.backgroundColor = backgroundColor?.CGColor
} }
} }
/// A property that accesses the layer.frame.origin.x property. /// A property that accesses the layer.frame.origin.x property.
public var x: CGFloat { @IBInspectable public var x: CGFloat {
get { get {
return layer.frame.origin.x return layer.frame.origin.x
} }
...@@ -87,7 +93,7 @@ public class MaterialButton : UIButton { ...@@ -87,7 +93,7 @@ public class MaterialButton : UIButton {
} }
/// A property that accesses the layer.frame.origin.y property. /// A property that accesses the layer.frame.origin.y property.
public var y: CGFloat { @IBInspectable public var y: CGFloat {
get { get {
return layer.frame.origin.y return layer.frame.origin.y
} }
...@@ -102,7 +108,7 @@ public class MaterialButton : UIButton { ...@@ -102,7 +108,7 @@ public class MaterialButton : UIButton {
value that is not .None, the height will be adjusted to maintain the correct value that is not .None, the height will be adjusted to maintain the correct
shape. shape.
*/ */
public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return layer.frame.size.width return layer.frame.size.width
} }
...@@ -120,7 +126,7 @@ public class MaterialButton : UIButton { ...@@ -120,7 +126,7 @@ public class MaterialButton : UIButton {
value that is not .None, the width will be adjusted to maintain the correct value that is not .None, the width will be adjusted to maintain the correct
shape. shape.
*/ */
public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return layer.frame.size.height return layer.frame.size.height
} }
...@@ -133,7 +139,7 @@ public class MaterialButton : UIButton { ...@@ -133,7 +139,7 @@ public class MaterialButton : UIButton {
} }
/// A property that accesses the backing layer's shadowColor. /// A property that accesses the backing layer's shadowColor.
public var shadowColor: UIColor? { @IBInspectable public var shadowColor: UIColor? {
didSet { didSet {
layer.shadowColor = shadowColor?.CGColor layer.shadowColor = shadowColor?.CGColor
} }
...@@ -150,7 +156,7 @@ public class MaterialButton : UIButton { ...@@ -150,7 +156,7 @@ public class MaterialButton : UIButton {
} }
/// A property that accesses the backing layer's shadowOpacity. /// A property that accesses the backing layer's shadowOpacity.
public var shadowOpacity: Float { @IBInspectable public var shadowOpacity: Float {
get { get {
return layer.shadowOpacity return layer.shadowOpacity
} }
...@@ -160,7 +166,7 @@ public class MaterialButton : UIButton { ...@@ -160,7 +166,7 @@ public class MaterialButton : UIButton {
} }
/// A property that accesses the backing layer's shadowRadius. /// A property that accesses the backing layer's shadowRadius.
public var shadowRadius: CGFloat { @IBInspectable public var shadowRadius: CGFloat {
get { get {
return layer.shadowRadius return layer.shadowRadius
} }
...@@ -180,7 +186,7 @@ public class MaterialButton : UIButton { ...@@ -180,7 +186,7 @@ public class MaterialButton : UIButton {
} }
/// Enables automatic shadowPath sizing. /// Enables automatic shadowPath sizing.
public var shadowPathAutoSizeEnabled: Bool = true { @IBInspectable public var shadowPathAutoSizeEnabled: Bool = true {
didSet { didSet {
if shadowPathAutoSizeEnabled { if shadowPathAutoSizeEnabled {
layoutShadowPath() layoutShadowPath()
...@@ -219,7 +225,7 @@ public class MaterialButton : UIButton { ...@@ -219,7 +225,7 @@ public class MaterialButton : UIButton {
} }
/// A property that accesses the layer.cornerRadius. /// A property that accesses the layer.cornerRadius.
public var cornerRadius: CGFloat { @IBInspectable public var cornerRadius: CGFloat {
get { get {
return layer.cornerRadius return layer.cornerRadius
} }
...@@ -258,7 +264,7 @@ public class MaterialButton : UIButton { ...@@ -258,7 +264,7 @@ public class MaterialButton : UIButton {
} }
/// A property that accesses the layer.borderWith. /// A property that accesses the layer.borderWith.
public var borderWidth: CGFloat { @IBInspectable public var borderWidth: CGFloat {
get { get {
return layer.borderWidth return layer.borderWidth
} }
...@@ -268,7 +274,7 @@ public class MaterialButton : UIButton { ...@@ -268,7 +274,7 @@ public class MaterialButton : UIButton {
} }
/// A property that accesses the layer.borderColor property. /// A property that accesses the layer.borderColor property.
public var borderColor: UIColor? { @IBInspectable public var borderColor: UIColor? {
get { get {
return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!) return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!)
} }
...@@ -278,7 +284,7 @@ public class MaterialButton : UIButton { ...@@ -278,7 +284,7 @@ public class MaterialButton : UIButton {
} }
/// A property that accesses the layer.position property. /// A property that accesses the layer.position property.
public var position: CGPoint { @IBInspectable public var position: CGPoint {
get { get {
return layer.position return layer.position
} }
...@@ -288,7 +294,7 @@ public class MaterialButton : UIButton { ...@@ -288,7 +294,7 @@ public class MaterialButton : UIButton {
} }
/// A property that accesses the layer.zPosition property. /// A property that accesses the layer.zPosition property.
public var zPosition: CGFloat { @IBInspectable public var zPosition: CGFloat {
get { get {
return layer.zPosition return layer.zPosition
} }
...@@ -397,6 +403,34 @@ public class MaterialButton : UIButton { ...@@ -397,6 +403,34 @@ public class MaterialButton : UIButton {
} }
/** /**
Triggers the pulse animation.
- Parameter point: A Optional point to pulse from, otherwise pulses
from the center.
*/
public func pulse(var point: CGPoint? = nil) {
if nil == point {
point = CGPointMake(CGFloat(width / 2), CGFloat(height / 2))
}
let duration: NSTimeInterval = MaterialAnimation.pulseDuration(width)
if let v: UIColor = pulseColor {
MaterialAnimation.pulseAnimation(layer, visualLayer: visualLayer, color: v.colorWithAlphaComponent(pulseOpacity), point: point!, width: width, height: height, duration: duration)
}
if pulseScale {
MaterialAnimation.expandAnimation(layer, scale: 1.05, duration: duration)
MaterialAnimation.delay(duration) { [weak self] in
if let l: CALayer = self?.layer {
if let w: CGFloat = self?.width {
MaterialAnimation.shrinkAnimation(l, width: w, duration: duration)
}
}
}
}
}
/**
A delegation method that is executed when the view has began a A delegation method that is executed when the view has began a
touch event. touch event.
- Parameter touches: A set of UITouch objects. - Parameter touches: A set of UITouch objects.
...@@ -404,7 +438,19 @@ public class MaterialButton : UIButton { ...@@ -404,7 +438,19 @@ public class MaterialButton : UIButton {
*/ */
public override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { public override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesBegan(touches, withEvent: event) super.touchesBegan(touches, withEvent: event)
pulseAnimation(layer.convertPoint(touches.first!.locationInView(self), fromLayer: layer)) let duration: NSTimeInterval = MaterialAnimation.pulseDuration(width)
if pulseFocus {
pulseLayer = CAShapeLayer()
}
if let v: UIColor = pulseColor {
MaterialAnimation.pulseAnimation(layer, visualLayer: visualLayer, color: v.colorWithAlphaComponent(pulseOpacity), point: layer.convertPoint(touches.first!.locationInView(self), fromLayer: layer), width: width, height: height, duration: duration, pulseLayer: pulseLayer)
}
if pulseScale {
MaterialAnimation.expandAnimation(layer, scale: 1.05, duration: duration)
}
} }
/** /**
...@@ -415,7 +461,7 @@ public class MaterialButton : UIButton { ...@@ -415,7 +461,7 @@ public class MaterialButton : UIButton {
*/ */
public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) { public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesEnded(touches, withEvent: event) super.touchesEnded(touches, withEvent: event)
shrinkAnimation() MaterialAnimation.shrinkAnimation(layer, width: width, duration: MaterialAnimation.pulseDuration(width), pulseLayer: pulseLayer)
} }
/** /**
...@@ -426,24 +472,7 @@ public class MaterialButton : UIButton { ...@@ -426,24 +472,7 @@ public class MaterialButton : UIButton {
*/ */
public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) { public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) {
super.touchesCancelled(touches, withEvent: event) super.touchesCancelled(touches, withEvent: event)
shrinkAnimation() MaterialAnimation.shrinkAnimation(layer, width: width, duration: MaterialAnimation.pulseDuration(width), pulseLayer: pulseLayer)
}
/**
Triggers the pulse animation.
- Parameter point: A Optional point to pulse from, otherwise pulses
from the center.
*/
public func pulse(var point: CGPoint? = nil) {
if nil == point {
point = CGPointMake(CGFloat(width / 2), CGFloat(height / 2))
}
if let v: CFTimeInterval = pulseAnimation(point!) {
MaterialAnimation.delay(v) { [weak self] in
self?.shrinkAnimation()
}
}
} }
/** /**
...@@ -493,70 +522,4 @@ public class MaterialButton : UIButton { ...@@ -493,70 +522,4 @@ public class MaterialButton : UIButton {
} }
} }
} }
/**
Triggers the pulse animation.
- Parameter point: A point to pulse from.
- Returns: A Ooptional CFTimeInternal if the point exists within
the view. The time internal represents the animation time.
*/
internal func pulseAnimation(point: CGPoint) -> CFTimeInterval? {
if true == layer.containsPoint(point) {
let r: CGFloat = (width < height ? height : width) / 2
let f: CGFloat = 3
let v: CGFloat = r / f
let d: CGFloat = 2 * f
let s: CGFloat = 1.05
var t: CFTimeInterval = CFTimeInterval(1.5 * width / MaterialDevice.width)
if 0.55 < t || 0.25 > t {
t = 0.55
}
t /= 1.3
if nil != pulseColor && 0 < pulseColorOpacity {
let pulseLayer: CAShapeLayer = CAShapeLayer()
pulseLayer.hidden = true
pulseLayer.zPosition = 1
pulseLayer.backgroundColor = pulseColor?.colorWithAlphaComponent(pulseColorOpacity).CGColor
visualLayer.addSublayer(pulseLayer)
MaterialAnimation.animationDisabled {
pulseLayer.bounds = CGRectMake(0, 0, v, v)
pulseLayer.position = point
pulseLayer.cornerRadius = r / d
pulseLayer.hidden = false
}
pulseLayer.addAnimation(MaterialAnimation.scale(3 * d, duration: t), forKey: nil)
MaterialAnimation.delay(t) { [weak self] in
if nil != self?.pulseColor && 0 < self?.pulseColorOpacity {
MaterialAnimation.animateWithDuration(t, animations: {
pulseLayer.hidden = true
}) {
pulseLayer.removeFromSuperlayer()
}
}
}
}
if pulseScale {
layer.addAnimation(MaterialAnimation.scale(s, duration: t), forKey: nil)
return t
}
}
return nil
}
/// Executes the shrink animation for the pulse effect.
internal func shrinkAnimation() {
if pulseScale {
var t: CFTimeInterval = CFTimeInterval(1.5 * width / MaterialDevice.width)
if 0.55 < t || 0.25 > t {
t = 0.55
}
t /= 1.3
layer.addAnimation(MaterialAnimation.scale(1, duration: t), forKey: nil)
}
}
} }
\ No newline at end of file
...@@ -68,7 +68,7 @@ public class MaterialCollectionView : UICollectionView { ...@@ -68,7 +68,7 @@ public class MaterialCollectionView : UICollectionView {
} }
/// Spacing between items. /// Spacing between items.
public var spacing: CGFloat { @IBInspectable public var spacing: CGFloat {
get { get {
return (collectionViewLayout as? MaterialCollectionViewLayout)!.spacing return (collectionViewLayout as? MaterialCollectionViewLayout)!.spacing
} }
......
...@@ -45,21 +45,27 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -45,21 +45,27 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
*/ */
public weak var delegate: MaterialDelegate? public weak var delegate: MaterialDelegate?
/// To use a single pulse and have it focused when held.
@IBInspectable public var pulseFocus: Bool = false
/// A pulse layer for focus handling.
public private(set) var pulseLayer: CAShapeLayer?
/// Sets whether the scaling animation should be used. /// Sets whether the scaling animation should be used.
public lazy var pulseScale: Bool = true @IBInspectable public lazy var pulseScale: Bool = true
/// The opcaity value for the pulse animation. /// The opcaity value for the pulse animation.
public var pulseColorOpacity: CGFloat = 0.25 @IBInspectable public var pulseOpacity: CGFloat = 0.25
/// The color of the pulse effect. /// The color of the pulse effect.
public var pulseColor: UIColor? @IBInspectable public var pulseColor: UIColor?
/** /**
A property that manages an image for the visualLayer's contents A property that manages an image for the visualLayer's contents
property. Images should not be set to the backing layer's contents property. Images should not be set to the backing layer's contents
property to avoid conflicts when using clipsToBounds. property to avoid conflicts when using clipsToBounds.
*/ */
public var image: UIImage? { @IBInspectable public var image: UIImage? {
didSet { didSet {
visualLayer.contents = image?.CGImage visualLayer.contents = image?.CGImage
} }
...@@ -98,7 +104,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -98,7 +104,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
dimensions of the visualLayer's contents property and the size dimensions of the visualLayer's contents property and the size
of the view. By default, this value is set to the MaterialDevice.scale. of the view. By default, this value is set to the MaterialDevice.scale.
*/ */
public var contentsScale: CGFloat { @IBInspectable public var contentsScale: CGFloat {
get { get {
return visualLayer.contentsScale return visualLayer.contentsScale
} }
...@@ -115,7 +121,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -115,7 +121,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
} }
/// Determines how content should be aligned within the visualLayer's bounds. /// Determines how content should be aligned within the visualLayer's bounds.
public var contentsGravity: String { @IBInspectable public var contentsGravity: String {
get { get {
return visualLayer.contentsGravity return visualLayer.contentsGravity
} }
...@@ -152,7 +158,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -152,7 +158,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
} }
/// A wrapper around grid.spacing. /// A wrapper around grid.spacing.
public var spacing: CGFloat { @IBInspectable public var spacing: CGFloat {
get { get {
return contentView.grid.spacing return contentView.grid.spacing
} }
...@@ -167,7 +173,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -167,7 +173,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
the image property, then this value does not need to be set, since the the image property, then this value does not need to be set, since the
visualLayer's maskToBounds is set to true by default. visualLayer's maskToBounds is set to true by default.
*/ */
public var masksToBounds: Bool { @IBInspectable public var masksToBounds: Bool {
get { get {
return layer.masksToBounds return layer.masksToBounds
} }
...@@ -177,14 +183,14 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -177,14 +183,14 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
} }
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's backgroundColor.
public override var backgroundColor: UIColor? { @IBInspectable public override var backgroundColor: UIColor? {
didSet { didSet {
layer.backgroundColor = backgroundColor?.CGColor layer.backgroundColor = backgroundColor?.CGColor
} }
} }
/// A property that accesses the layer.frame.origin.x property. /// A property that accesses the layer.frame.origin.x property.
public var x: CGFloat { @IBInspectable public var x: CGFloat {
get { get {
return layer.frame.origin.x return layer.frame.origin.x
} }
...@@ -194,7 +200,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -194,7 +200,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
} }
/// A property that accesses the layer.frame.origin.y property. /// A property that accesses the layer.frame.origin.y property.
public var y: CGFloat { @IBInspectable public var y: CGFloat {
get { get {
return layer.frame.origin.y return layer.frame.origin.y
} }
...@@ -209,7 +215,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -209,7 +215,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
value that is not .None, the height will be adjusted to maintain the correct value that is not .None, the height will be adjusted to maintain the correct
shape. shape.
*/ */
public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return layer.frame.size.width return layer.frame.size.width
} }
...@@ -227,7 +233,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -227,7 +233,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
value that is not .None, the width will be adjusted to maintain the correct value that is not .None, the width will be adjusted to maintain the correct
shape. shape.
*/ */
public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return layer.frame.size.height return layer.frame.size.height
} }
...@@ -240,7 +246,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -240,7 +246,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
} }
/// A property that accesses the backing layer's shadowColor. /// A property that accesses the backing layer's shadowColor.
public var shadowColor: UIColor? { @IBInspectable public var shadowColor: UIColor? {
didSet { didSet {
layer.shadowColor = shadowColor?.CGColor layer.shadowColor = shadowColor?.CGColor
} }
...@@ -257,7 +263,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -257,7 +263,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
} }
/// A property that accesses the backing layer's shadowOpacity. /// A property that accesses the backing layer's shadowOpacity.
public var shadowOpacity: Float { @IBInspectable public var shadowOpacity: Float {
get { get {
return layer.shadowOpacity return layer.shadowOpacity
} }
...@@ -267,7 +273,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -267,7 +273,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
} }
/// A property that accesses the backing layer's shadowRadius. /// A property that accesses the backing layer's shadowRadius.
public var shadowRadius: CGFloat { @IBInspectable public var shadowRadius: CGFloat {
get { get {
return layer.shadowRadius return layer.shadowRadius
} }
...@@ -287,7 +293,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -287,7 +293,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
} }
/// Enables automatic shadowPath sizing. /// Enables automatic shadowPath sizing.
public var shadowPathAutoSizeEnabled: Bool = true { @IBInspectable public var shadowPathAutoSizeEnabled: Bool = true {
didSet { didSet {
if shadowPathAutoSizeEnabled { if shadowPathAutoSizeEnabled {
layoutShadowPath() layoutShadowPath()
...@@ -326,7 +332,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -326,7 +332,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
} }
/// A property that accesses the layer.cornerRadius. /// A property that accesses the layer.cornerRadius.
public var cornerRadius: CGFloat { @IBInspectable public var cornerRadius: CGFloat {
get { get {
return layer.cornerRadius return layer.cornerRadius
} }
...@@ -365,7 +371,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -365,7 +371,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
} }
/// A property that accesses the layer.borderWith. /// A property that accesses the layer.borderWith.
public var borderWidth: CGFloat { @IBInspectable public var borderWidth: CGFloat {
get { get {
return layer.borderWidth return layer.borderWidth
} }
...@@ -375,7 +381,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -375,7 +381,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
} }
/// A property that accesses the layer.borderColor property. /// A property that accesses the layer.borderColor property.
public var borderColor: UIColor? { @IBInspectable public var borderColor: UIColor? {
get { get {
return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!) return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!)
} }
...@@ -395,7 +401,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -395,7 +401,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
} }
/// A property that accesses the layer.zPosition property. /// A property that accesses the layer.zPosition property.
public var zPosition: CGFloat { @IBInspectable public var zPosition: CGFloat {
get { get {
return layer.zPosition return layer.zPosition
} }
...@@ -502,6 +508,34 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -502,6 +508,34 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
} }
/** /**
Triggers the pulse animation.
- Parameter point: A Optional point to pulse from, otherwise pulses
from the center.
*/
public func pulse(var point: CGPoint? = nil) {
if nil == point {
point = CGPointMake(CGFloat(width / 2), CGFloat(height / 2))
}
let duration: NSTimeInterval = MaterialAnimation.pulseDuration(width)
if let v: UIColor = pulseColor {
MaterialAnimation.pulseAnimation(layer, visualLayer: visualLayer, color: v.colorWithAlphaComponent(pulseOpacity), point: point!, width: width, height: height, duration: duration)
}
if pulseScale {
MaterialAnimation.expandAnimation(layer, scale: 1.05, duration: duration)
MaterialAnimation.delay(duration) { [weak self] in
if let l: CALayer = self?.layer {
if let w: CGFloat = self?.width {
MaterialAnimation.shrinkAnimation(l, width: w, duration: duration)
}
}
}
}
}
/**
A delegation method that is executed when the view has began a A delegation method that is executed when the view has began a
touch event. touch event.
- Parameter touches: A set of UITouch objects. - Parameter touches: A set of UITouch objects.
...@@ -509,7 +543,19 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -509,7 +543,19 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
*/ */
public override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { public override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesBegan(touches, withEvent: event) super.touchesBegan(touches, withEvent: event)
pulseAnimation(layer.convertPoint(touches.first!.locationInView(self), fromLayer: layer)) let duration: NSTimeInterval = MaterialAnimation.pulseDuration(width)
if pulseFocus {
pulseLayer = CAShapeLayer()
}
if let v: UIColor = pulseColor {
MaterialAnimation.pulseAnimation(layer, visualLayer: visualLayer, color: v.colorWithAlphaComponent(pulseOpacity), point: layer.convertPoint(touches.first!.locationInView(self), fromLayer: layer), width: width, height: height, duration: duration, pulseLayer: pulseLayer)
}
if pulseScale {
MaterialAnimation.expandAnimation(layer, scale: 1.05, duration: duration)
}
} }
/** /**
...@@ -520,7 +566,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -520,7 +566,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
*/ */
public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) { public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesEnded(touches, withEvent: event) super.touchesEnded(touches, withEvent: event)
shrinkAnimation() MaterialAnimation.shrinkAnimation(layer, width: width, duration: MaterialAnimation.pulseDuration(width), pulseLayer: pulseLayer)
} }
/** /**
...@@ -531,24 +577,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -531,24 +577,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
*/ */
public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) { public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) {
super.touchesCancelled(touches, withEvent: event) super.touchesCancelled(touches, withEvent: event)
shrinkAnimation() MaterialAnimation.shrinkAnimation(layer, width: width, duration: MaterialAnimation.pulseDuration(width), pulseLayer: pulseLayer)
}
/**
Triggers the pulse animation.
- Parameter point: A Optional point to pulse from, otherwise pulses
from the center.
*/
public func pulse(var point: CGPoint? = nil) {
if nil == point {
point = CGPointMake(CGFloat(width / 2), CGFloat(height / 2))
}
if let v: CFTimeInterval = pulseAnimation(point!) {
MaterialAnimation.delay(v) { [weak self] in
self?.shrinkAnimation()
}
}
} }
/** /**
...@@ -599,70 +628,4 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -599,70 +628,4 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
} }
} }
} }
/**
Triggers the pulse animation.
- Parameter point: A point to pulse from.
- Returns: A Ooptional CFTimeInternal if the point exists within
the view. The time internal represents the animation time.
*/
internal func pulseAnimation(point: CGPoint) -> CFTimeInterval? {
if true == layer.containsPoint(point) {
let r: CGFloat = (width < height ? height : width) / 2
let f: CGFloat = 3
let v: CGFloat = r / f
let d: CGFloat = 2 * f
let s: CGFloat = 1.05
var t: CFTimeInterval = CFTimeInterval(1.5 * width / MaterialDevice.width)
if 0.55 < t || 0.25 > t {
t = 0.55
}
t /= 1.3
if nil != pulseColor && 0 < pulseColorOpacity {
let pulseLayer: CAShapeLayer = CAShapeLayer()
pulseLayer.hidden = true
pulseLayer.zPosition = 1
pulseLayer.backgroundColor = pulseColor?.colorWithAlphaComponent(pulseColorOpacity).CGColor
visualLayer.addSublayer(pulseLayer)
MaterialAnimation.animationDisabled {
pulseLayer.bounds = CGRectMake(0, 0, v, v)
pulseLayer.position = point
pulseLayer.cornerRadius = r / d
pulseLayer.hidden = false
}
pulseLayer.addAnimation(MaterialAnimation.scale(3 * d, duration: t), forKey: nil)
MaterialAnimation.delay(t) { [weak self] in
if nil != self?.pulseColor && 0 < self?.pulseColorOpacity {
MaterialAnimation.animateWithDuration(t, animations: {
pulseLayer.hidden = true
}) {
pulseLayer.removeFromSuperlayer()
}
}
}
}
if pulseScale {
layer.addAnimation(MaterialAnimation.scale(s, duration: t), forKey: nil)
return t
}
}
return nil
}
/// Executes the shrink animation for the pulse effect.
internal func shrinkAnimation() {
if pulseScale {
var t: CFTimeInterval = CFTimeInterval(1.5 * width / MaterialDevice.width)
if 0.55 < t || 0.25 > t {
t = 0.55
}
t /= 1.3
layer.addAnimation(MaterialAnimation.scale(1, duration: t), forKey: nil)
}
}
} }
\ No newline at end of file
...@@ -48,7 +48,7 @@ public class MaterialLabel : UILabel { ...@@ -48,7 +48,7 @@ public class MaterialLabel : UILabel {
/** /**
:name: text :name: text
*/ */
public override var text: String? { @IBInspectable public override var text: String? {
didSet { didSet {
textLayer.text = text textLayer.text = text
} }
...@@ -57,7 +57,7 @@ public class MaterialLabel : UILabel { ...@@ -57,7 +57,7 @@ public class MaterialLabel : UILabel {
/** /**
:name: textColor :name: textColor
*/ */
public override var textColor: UIColor? { @IBInspectable public override var textColor: UIColor? {
didSet { didSet {
textLayer.textColor = textColor textLayer.textColor = textColor
} }
...@@ -84,7 +84,7 @@ public class MaterialLabel : UILabel { ...@@ -84,7 +84,7 @@ public class MaterialLabel : UILabel {
/** /**
:name: wrapped :name: wrapped
*/ */
public var wrapped: Bool { @IBInspectable public var wrapped: Bool {
didSet { didSet {
textLayer.wrapped = wrapped textLayer.wrapped = wrapped
} }
...@@ -93,7 +93,7 @@ public class MaterialLabel : UILabel { ...@@ -93,7 +93,7 @@ public class MaterialLabel : UILabel {
/** /**
:name: contentsScale :name: contentsScale
*/ */
public var contentsScale: CGFloat { @IBInspectable public var contentsScale: CGFloat {
didSet { didSet {
textLayer.contentsScale = contentsScale textLayer.contentsScale = contentsScale
} }
......
...@@ -44,7 +44,7 @@ public class MaterialLayer : CAShapeLayer { ...@@ -44,7 +44,7 @@ public class MaterialLayer : CAShapeLayer {
public private(set) lazy var visualLayer: CAShapeLayer = CAShapeLayer() public private(set) lazy var visualLayer: CAShapeLayer = CAShapeLayer()
/// A property that accesses the layer.frame.origin.x property. /// A property that accesses the layer.frame.origin.x property.
public var x: CGFloat { @IBInspectable public var x: CGFloat {
get { get {
return frame.origin.x return frame.origin.x
} }
...@@ -54,7 +54,7 @@ public class MaterialLayer : CAShapeLayer { ...@@ -54,7 +54,7 @@ public class MaterialLayer : CAShapeLayer {
} }
/// A property that accesses the layer.frame.origin.y property. /// A property that accesses the layer.frame.origin.y property.
public var y: CGFloat { @IBInspectable public var y: CGFloat {
get { get {
return frame.origin.y return frame.origin.y
} }
...@@ -69,7 +69,7 @@ public class MaterialLayer : CAShapeLayer { ...@@ -69,7 +69,7 @@ public class MaterialLayer : CAShapeLayer {
value that is not .None, the height will be adjusted to maintain the correct value that is not .None, the height will be adjusted to maintain the correct
shape. shape.
*/ */
public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return frame.size.width return frame.size.width
} }
...@@ -87,7 +87,7 @@ public class MaterialLayer : CAShapeLayer { ...@@ -87,7 +87,7 @@ public class MaterialLayer : CAShapeLayer {
value that is not .None, the width will be adjusted to maintain the correct value that is not .None, the width will be adjusted to maintain the correct
shape. shape.
*/ */
public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return frame.size.height return frame.size.height
} }
...@@ -104,7 +104,7 @@ public class MaterialLayer : CAShapeLayer { ...@@ -104,7 +104,7 @@ public class MaterialLayer : CAShapeLayer {
property. Images should not be set to the backing layer's contents property. Images should not be set to the backing layer's contents
property to avoid conflicts when using clipsToBounds. property to avoid conflicts when using clipsToBounds.
*/ */
public var image: UIImage? { @IBInspectable public var image: UIImage? {
didSet { didSet {
visualLayer.contents = image?.CGImage visualLayer.contents = image?.CGImage
} }
...@@ -137,7 +137,7 @@ public class MaterialLayer : CAShapeLayer { ...@@ -137,7 +137,7 @@ public class MaterialLayer : CAShapeLayer {
dimensions of the visualLayer's contents property and the size dimensions of the visualLayer's contents property and the size
of the layer. By default, this value is set to the MaterialDevice.scale. of the layer. By default, this value is set to the MaterialDevice.scale.
*/ */
public override var contentsScale: CGFloat { @IBInspectable public override var contentsScale: CGFloat {
didSet { didSet {
visualLayer.contentsScale = contentsScale visualLayer.contentsScale = contentsScale
} }
...@@ -151,7 +151,7 @@ public class MaterialLayer : CAShapeLayer { ...@@ -151,7 +151,7 @@ public class MaterialLayer : CAShapeLayer {
} }
/// Determines how content should be aligned within the visualLayer's bounds. /// Determines how content should be aligned within the visualLayer's bounds.
public override var contentsGravity: String { @IBInspectable public override var contentsGravity: String {
get { get {
return visualLayer.contentsGravity return visualLayer.contentsGravity
} }
...@@ -161,7 +161,7 @@ public class MaterialLayer : CAShapeLayer { ...@@ -161,7 +161,7 @@ public class MaterialLayer : CAShapeLayer {
} }
/// Enables automatic shadowPath sizing. /// Enables automatic shadowPath sizing.
public var shadowPathAutoSizeEnabled: Bool = true { @IBInspectable public var shadowPathAutoSizeEnabled: Bool = true {
didSet { didSet {
if shadowPathAutoSizeEnabled { if shadowPathAutoSizeEnabled {
layoutShadowPath() layoutShadowPath()
...@@ -204,7 +204,7 @@ public class MaterialLayer : CAShapeLayer { ...@@ -204,7 +204,7 @@ public class MaterialLayer : CAShapeLayer {
property has a value of .Circle when the cornerRadius is set, it will property has a value of .Circle when the cornerRadius is set, it will
become .None, as it no longer maintains its circle shape. become .None, as it no longer maintains its circle shape.
*/ */
public override var cornerRadius: CGFloat { @IBInspectable public override var cornerRadius: CGFloat {
didSet { didSet {
layoutShadowPath() layoutShadowPath()
if .Circle == shape { if .Circle == shape {
......
...@@ -32,19 +32,19 @@ import UIKit ...@@ -32,19 +32,19 @@ import UIKit
public class MaterialPulseView : MaterialView { public class MaterialPulseView : MaterialView {
/// To use a single pulse and have it focused when held. /// To use a single pulse and have it focused when held.
public var pulseFocus: Bool = false @IBInspectable public var pulseFocus: Bool = false
/// A pulse layer for focus handling. /// A pulse layer for focus handling.
public private(set) var pulseLayer: CAShapeLayer? public private(set) var pulseLayer: CAShapeLayer?
/// Sets whether the scaling animation should be used. /// Sets whether the scaling animation should be used.
public lazy var pulseScale: Bool = true @IBInspectable public lazy var pulseScale: Bool = true
/// The opcaity value for the pulse animation. /// The opcaity value for the pulse animation.
public var pulseColorOpacity: CGFloat = 0.25 @IBInspectable public var pulseOpacity: CGFloat = 0.25
/// The color of the pulse effect. /// The color of the pulse effect.
public var pulseColor: UIColor? @IBInspectable public var pulseColor: UIColor?
/** /**
Triggers the pulse animation. Triggers the pulse animation.
...@@ -59,7 +59,7 @@ public class MaterialPulseView : MaterialView { ...@@ -59,7 +59,7 @@ public class MaterialPulseView : MaterialView {
let duration: NSTimeInterval = MaterialAnimation.pulseDuration(width) let duration: NSTimeInterval = MaterialAnimation.pulseDuration(width)
if let v: UIColor = pulseColor { if let v: UIColor = pulseColor {
MaterialAnimation.pulseAnimation(layer, visualLayer: visualLayer, color: v.colorWithAlphaComponent(pulseColorOpacity), point: point!, width: width, height: height, duration: duration) MaterialAnimation.pulseAnimation(layer, visualLayer: visualLayer, color: v.colorWithAlphaComponent(pulseOpacity), point: point!, width: width, height: height, duration: duration)
} }
if pulseScale { if pulseScale {
...@@ -89,9 +89,7 @@ public class MaterialPulseView : MaterialView { ...@@ -89,9 +89,7 @@ public class MaterialPulseView : MaterialView {
} }
if let v: UIColor = pulseColor { if let v: UIColor = pulseColor {
let point: CGPoint = layer.convertPoint(touches.first!.locationInView(self), fromLayer: layer) MaterialAnimation.pulseAnimation(layer, visualLayer: visualLayer, color: v.colorWithAlphaComponent(pulseOpacity), point: layer.convertPoint(touches.first!.locationInView(self), fromLayer: layer), width: width, height: height, duration: duration, pulseLayer: pulseLayer)
MaterialAnimation.pulseAnimation(layer, visualLayer: visualLayer, color: v.colorWithAlphaComponent(pulseColorOpacity), point: point, width: width, height: height, duration: duration, pulseLayer: pulseLayer)
} }
if pulseScale { if pulseScale {
......
...@@ -74,7 +74,7 @@ public class MaterialSwitch: UIControl { ...@@ -74,7 +74,7 @@ public class MaterialSwitch: UIControl {
private var bounceOffset: CGFloat = 3 private var bounceOffset: CGFloat = 3
/// A property that accesses the layer.frame.origin.x property. /// A property that accesses the layer.frame.origin.x property.
public var x: CGFloat { @IBInspectable public var x: CGFloat {
get { get {
return layer.frame.origin.x return layer.frame.origin.x
} }
...@@ -84,7 +84,7 @@ public class MaterialSwitch: UIControl { ...@@ -84,7 +84,7 @@ public class MaterialSwitch: UIControl {
} }
/// A property that accesses the layer.frame.origin.y property. /// A property that accesses the layer.frame.origin.y property.
public var y: CGFloat { @IBInspectable public var y: CGFloat {
get { get {
return layer.frame.origin.y return layer.frame.origin.y
} }
...@@ -94,7 +94,7 @@ public class MaterialSwitch: UIControl { ...@@ -94,7 +94,7 @@ public class MaterialSwitch: UIControl {
} }
/// A property that accesses the layer.frame.origin.width property. /// A property that accesses the layer.frame.origin.width property.
public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return layer.frame.size.width return layer.frame.size.width
} }
...@@ -104,7 +104,7 @@ public class MaterialSwitch: UIControl { ...@@ -104,7 +104,7 @@ public class MaterialSwitch: UIControl {
} }
/// A property that accesses the layer.frame.origin.height property. /// A property that accesses the layer.frame.origin.height property.
public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return layer.frame.size.height return layer.frame.size.height
} }
...@@ -117,35 +117,35 @@ public class MaterialSwitch: UIControl { ...@@ -117,35 +117,35 @@ public class MaterialSwitch: UIControl {
public var delegate: MaterialSwitchDelegate? public var delegate: MaterialSwitchDelegate?
/// Indicates if the animation should bounce. /// Indicates if the animation should bounce.
public var bounceable: Bool = true { @IBInspectable public var bounceable: Bool = true {
didSet { didSet {
bounceOffset = bounceable ? 3 : 0 bounceOffset = bounceable ? 3 : 0
} }
} }
/// Button on color. /// Button on color.
public var buttonOnColor: UIColor = MaterialColor.clear @IBInspectable public var buttonOnColor: UIColor = MaterialColor.clear
/// Button off color. /// Button off color.
public var buttonOffColor: UIColor = MaterialColor.clear @IBInspectable public var buttonOffColor: UIColor = MaterialColor.clear
/// Track on color. /// Track on color.
public var trackOnColor: UIColor = MaterialColor.clear @IBInspectable public var trackOnColor: UIColor = MaterialColor.clear
/// Track off color. /// Track off color.
public var trackOffColor: UIColor = MaterialColor.clear @IBInspectable public var trackOffColor: UIColor = MaterialColor.clear
/// Button on disabled color. /// Button on disabled color.
public var buttonOnDisabledColor: UIColor = MaterialColor.clear @IBInspectable public var buttonOnDisabledColor: UIColor = MaterialColor.clear
/// Track on disabled color. /// Track on disabled color.
public var trackOnDisabledColor: UIColor = MaterialColor.clear @IBInspectable public var trackOnDisabledColor: UIColor = MaterialColor.clear
/// Button off disabled color. /// Button off disabled color.
public var buttonOffDisabledColor: UIColor = MaterialColor.clear @IBInspectable public var buttonOffDisabledColor: UIColor = MaterialColor.clear
/// Track off disabled color. /// Track off disabled color.
public var trackOffDisabledColor: UIColor = MaterialColor.clear @IBInspectable public var trackOffDisabledColor: UIColor = MaterialColor.clear
/// Track view reference. /// Track view reference.
public private(set) var trackLayer: MaterialLayer { public private(set) var trackLayer: MaterialLayer {
...@@ -161,14 +161,14 @@ public class MaterialSwitch: UIControl { ...@@ -161,14 +161,14 @@ public class MaterialSwitch: UIControl {
} }
} }
public override var enabled: Bool { @IBInspectable public override var enabled: Bool {
didSet { didSet {
styleForState(internalSwitchState) styleForState(internalSwitchState)
} }
} }
/// A boolean indicating if the switch is on or not. /// A boolean indicating if the switch is on or not.
public var on: Bool { @IBInspectable public var on: Bool {
get { get {
return .On == internalSwitchState return .On == internalSwitchState
} }
......
...@@ -44,14 +44,20 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -44,14 +44,20 @@ public class MaterialTableViewCell: UITableViewCell {
*/ */
public weak var delegate: MaterialDelegate? public weak var delegate: MaterialDelegate?
/// To use a single pulse and have it focused when held.
@IBInspectable public var pulseFocus: Bool = false
/// A pulse layer for focus handling.
public private(set) var pulseLayer: CAShapeLayer?
/// Sets whether the scaling animation should be used. /// Sets whether the scaling animation should be used.
public lazy var pulseScale: Bool = true @IBInspectable public lazy var pulseScale: Bool = true
/// The opcaity value for the pulse animation. /// The opcaity value for the pulse animation.
public var pulseColorOpacity: CGFloat = 0.25 @IBInspectable public var pulseOpacity: CGFloat = 0.25
/// The color of the pulse effect. /// The color of the pulse effect.
public var pulseColor: UIColor? @IBInspectable public var pulseColor: UIColor?
/** /**
This property is the same as clipsToBounds. It crops any of the view's This property is the same as clipsToBounds. It crops any of the view's
...@@ -59,7 +65,7 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -59,7 +65,7 @@ public class MaterialTableViewCell: UITableViewCell {
the image property, then this value does not need to be set, since the the image property, then this value does not need to be set, since the
visualLayer's maskToBounds is set to true by default. visualLayer's maskToBounds is set to true by default.
*/ */
public var masksToBounds: Bool { @IBInspectable public var masksToBounds: Bool {
get { get {
return layer.masksToBounds return layer.masksToBounds
} }
...@@ -69,14 +75,14 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -69,14 +75,14 @@ public class MaterialTableViewCell: UITableViewCell {
} }
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's backgroundColor.
public override var backgroundColor: UIColor? { @IBInspectable public override var backgroundColor: UIColor? {
didSet { didSet {
layer.backgroundColor = backgroundColor?.CGColor layer.backgroundColor = backgroundColor?.CGColor
} }
} }
/// A property that accesses the layer.frame.origin.x property. /// A property that accesses the layer.frame.origin.x property.
public var x: CGFloat { @IBInspectable public var x: CGFloat {
get { get {
return layer.frame.origin.x return layer.frame.origin.x
} }
...@@ -86,7 +92,7 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -86,7 +92,7 @@ public class MaterialTableViewCell: UITableViewCell {
} }
/// A property that accesses the layer.frame.origin.y property. /// A property that accesses the layer.frame.origin.y property.
public var y: CGFloat { @IBInspectable public var y: CGFloat {
get { get {
return layer.frame.origin.y return layer.frame.origin.y
} }
...@@ -101,7 +107,7 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -101,7 +107,7 @@ public class MaterialTableViewCell: UITableViewCell {
value that is not .None, the height will be adjusted to maintain the correct value that is not .None, the height will be adjusted to maintain the correct
shape. shape.
*/ */
public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return layer.frame.size.width return layer.frame.size.width
} }
...@@ -116,7 +122,7 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -116,7 +122,7 @@ public class MaterialTableViewCell: UITableViewCell {
value that is not .None, the width will be adjusted to maintain the correct value that is not .None, the width will be adjusted to maintain the correct
shape. shape.
*/ */
public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return layer.frame.size.height return layer.frame.size.height
} }
...@@ -126,7 +132,7 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -126,7 +132,7 @@ public class MaterialTableViewCell: UITableViewCell {
} }
/// A property that accesses the backing layer's shadowColor. /// A property that accesses the backing layer's shadowColor.
public var shadowColor: UIColor? { @IBInspectable public var shadowColor: UIColor? {
didSet { didSet {
layer.shadowColor = shadowColor?.CGColor layer.shadowColor = shadowColor?.CGColor
} }
...@@ -143,7 +149,7 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -143,7 +149,7 @@ public class MaterialTableViewCell: UITableViewCell {
} }
/// A property that accesses the backing layer's shadowOpacity. /// A property that accesses the backing layer's shadowOpacity.
public var shadowOpacity: Float { @IBInspectable public var shadowOpacity: Float {
get { get {
return layer.shadowOpacity return layer.shadowOpacity
} }
...@@ -153,7 +159,7 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -153,7 +159,7 @@ public class MaterialTableViewCell: UITableViewCell {
} }
/// A property that accesses the backing layer's shadowRadius. /// A property that accesses the backing layer's shadowRadius.
public var shadowRadius: CGFloat { @IBInspectable public var shadowRadius: CGFloat {
get { get {
return layer.shadowRadius return layer.shadowRadius
} }
...@@ -173,7 +179,7 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -173,7 +179,7 @@ public class MaterialTableViewCell: UITableViewCell {
} }
/// Enables automatic shadowPath sizing. /// Enables automatic shadowPath sizing.
public var shadowPathAutoSizeEnabled: Bool = true { @IBInspectable public var shadowPathAutoSizeEnabled: Bool = true {
didSet { didSet {
if shadowPathAutoSizeEnabled { if shadowPathAutoSizeEnabled {
layoutShadowPath() layoutShadowPath()
...@@ -212,7 +218,7 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -212,7 +218,7 @@ public class MaterialTableViewCell: UITableViewCell {
} }
/// A property that accesses the layer.cornerRadius. /// A property that accesses the layer.cornerRadius.
public var cornerRadius: CGFloat { @IBInspectable public var cornerRadius: CGFloat {
get { get {
return layer.cornerRadius return layer.cornerRadius
} }
...@@ -230,7 +236,7 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -230,7 +236,7 @@ public class MaterialTableViewCell: UITableViewCell {
} }
/// A property that accesses the layer.borderWith. /// A property that accesses the layer.borderWith.
public var borderWidth: CGFloat { @IBInspectable public var borderWidth: CGFloat {
get { get {
return layer.borderWidth return layer.borderWidth
} }
...@@ -240,7 +246,7 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -240,7 +246,7 @@ public class MaterialTableViewCell: UITableViewCell {
} }
/// A property that accesses the layer.borderColor property. /// A property that accesses the layer.borderColor property.
public var borderColor: UIColor? { @IBInspectable public var borderColor: UIColor? {
get { get {
return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!) return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!)
} }
...@@ -260,7 +266,7 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -260,7 +266,7 @@ public class MaterialTableViewCell: UITableViewCell {
} }
/// A property that accesses the layer.zPosition property. /// A property that accesses the layer.zPosition property.
public var zPosition: CGFloat { @IBInspectable public var zPosition: CGFloat {
get { get {
return layer.zPosition return layer.zPosition
} }
...@@ -352,6 +358,34 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -352,6 +358,34 @@ public class MaterialTableViewCell: UITableViewCell {
} }
/** /**
Triggers the pulse animation.
- Parameter point: A Optional point to pulse from, otherwise pulses
from the center.
*/
public func pulse(var point: CGPoint? = nil) {
if nil == point {
point = CGPointMake(CGFloat(width / 2), CGFloat(height / 2))
}
let duration: NSTimeInterval = MaterialAnimation.pulseDuration(width)
if let v: UIColor = pulseColor {
MaterialAnimation.pulseAnimation(layer, visualLayer: visualLayer, color: v.colorWithAlphaComponent(pulseOpacity), point: point!, width: width, height: height, duration: duration)
}
if pulseScale {
MaterialAnimation.expandAnimation(layer, scale: 1.05, duration: duration)
MaterialAnimation.delay(duration) { [weak self] in
if let l: CALayer = self?.layer {
if let w: CGFloat = self?.width {
MaterialAnimation.shrinkAnimation(l, width: w, duration: duration)
}
}
}
}
}
/**
A delegation method that is executed when the view has began a A delegation method that is executed when the view has began a
touch event. touch event.
- Parameter touches: A set of UITouch objects. - Parameter touches: A set of UITouch objects.
...@@ -359,7 +393,19 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -359,7 +393,19 @@ public class MaterialTableViewCell: UITableViewCell {
*/ */
public override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { public override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesBegan(touches, withEvent: event) super.touchesBegan(touches, withEvent: event)
pulseAnimation(layer.convertPoint(touches.first!.locationInView(self), fromLayer: layer)) let duration: NSTimeInterval = MaterialAnimation.pulseDuration(width)
if pulseFocus {
pulseLayer = CAShapeLayer()
}
if let v: UIColor = pulseColor {
MaterialAnimation.pulseAnimation(layer, visualLayer: visualLayer, color: v.colorWithAlphaComponent(pulseOpacity), point: layer.convertPoint(touches.first!.locationInView(self), fromLayer: layer), width: width, height: height, duration: duration, pulseLayer: pulseLayer)
}
if pulseScale {
MaterialAnimation.expandAnimation(layer, scale: 1.05, duration: duration)
}
} }
/** /**
...@@ -370,7 +416,7 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -370,7 +416,7 @@ public class MaterialTableViewCell: UITableViewCell {
*/ */
public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) { public override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) {
super.touchesEnded(touches, withEvent: event) super.touchesEnded(touches, withEvent: event)
shrinkAnimation() MaterialAnimation.shrinkAnimation(layer, width: width, duration: MaterialAnimation.pulseDuration(width), pulseLayer: pulseLayer)
} }
/** /**
...@@ -381,24 +427,7 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -381,24 +427,7 @@ public class MaterialTableViewCell: UITableViewCell {
*/ */
public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) { public override func touchesCancelled(touches: Set<UITouch>?, withEvent event: UIEvent?) {
super.touchesCancelled(touches, withEvent: event) super.touchesCancelled(touches, withEvent: event)
shrinkAnimation() MaterialAnimation.shrinkAnimation(layer, width: width, duration: MaterialAnimation.pulseDuration(width), pulseLayer: pulseLayer)
}
/**
Triggers the pulse animation.
- Parameter point: A Optional point to pulse from, otherwise pulses
from the center.
*/
public func pulse(var point: CGPoint? = nil) {
if nil == point {
point = CGPointMake(CGFloat(width / 2), CGFloat(height / 2))
}
if let v: CFTimeInterval = pulseAnimation(point!) {
MaterialAnimation.delay(v) { [weak self] in
self?.shrinkAnimation()
}
}
} }
/** /**
...@@ -443,70 +472,4 @@ public class MaterialTableViewCell: UITableViewCell { ...@@ -443,70 +472,4 @@ public class MaterialTableViewCell: UITableViewCell {
} }
} }
} }
/**
Triggers the pulse animation.
- Parameter point: A point to pulse from.
- Returns: A Ooptional CFTimeInternal if the point exists within
the view. The time internal represents the animation time.
*/
internal func pulseAnimation(point: CGPoint) -> CFTimeInterval? {
if true == layer.containsPoint(point) {
let r: CGFloat = (width < height ? height : width) / 2
let f: CGFloat = 3
let v: CGFloat = r / f
let d: CGFloat = 2 * f
let s: CGFloat = 1.05
var t: CFTimeInterval = CFTimeInterval(1.5 * width / MaterialDevice.width)
if 0.55 < t || 0.25 > t {
t = 0.55
}
t /= 1.3
if nil != pulseColor && 0 < pulseColorOpacity {
let pulseLayer: CAShapeLayer = CAShapeLayer()
pulseLayer.hidden = true
pulseLayer.zPosition = 1
pulseLayer.backgroundColor = pulseColor?.colorWithAlphaComponent(pulseColorOpacity).CGColor
visualLayer.addSublayer(pulseLayer)
MaterialAnimation.animationDisabled {
pulseLayer.bounds = CGRectMake(0, 0, v, v)
pulseLayer.position = point
pulseLayer.cornerRadius = r / d
pulseLayer.hidden = false
}
pulseLayer.addAnimation(MaterialAnimation.scale(3 * d, duration: t), forKey: nil)
MaterialAnimation.delay(t) { [weak self] in
if nil != self?.pulseColor && 0 < self?.pulseColorOpacity {
MaterialAnimation.animateWithDuration(t, animations: {
pulseLayer.hidden = true
}) {
pulseLayer.removeFromSuperlayer()
}
}
}
}
if pulseScale {
layer.addAnimation(MaterialAnimation.scale(s, duration: t), forKey: nil)
return t
}
}
return nil
}
/// Executes the shrink animation for the pulse effect.
internal func shrinkAnimation() {
if pulseScale {
var t: CFTimeInterval = CFTimeInterval(1.5 * width / MaterialDevice.width)
if 0.55 < t || 0.25 > t {
t = 0.55
}
t /= 1.3
layer.addAnimation(MaterialAnimation.scale(1, duration: t), forKey: nil)
}
}
} }
...@@ -46,7 +46,7 @@ public class MaterialTextLayer : CATextLayer { ...@@ -46,7 +46,7 @@ public class MaterialTextLayer : CATextLayer {
/** /**
:name: text :name: text
*/ */
public var text: String? { @IBInspectable public var text: String? {
didSet { didSet {
string = text as? AnyObject string = text as? AnyObject
} }
...@@ -55,7 +55,7 @@ public class MaterialTextLayer : CATextLayer { ...@@ -55,7 +55,7 @@ public class MaterialTextLayer : CATextLayer {
/** /**
:name: pointSize :name: pointSize
*/ */
public var pointSize: CGFloat = 10 { @IBInspectable public var pointSize: CGFloat = 10 {
didSet { didSet {
fontSize = pointSize fontSize = pointSize
} }
...@@ -64,7 +64,7 @@ public class MaterialTextLayer : CATextLayer { ...@@ -64,7 +64,7 @@ public class MaterialTextLayer : CATextLayer {
/** /**
:name: textColor :name: textColor
*/ */
public var textColor: UIColor? { @IBInspectable public var textColor: UIColor? {
didSet { didSet {
foregroundColor = textColor?.CGColor foregroundColor = textColor?.CGColor
} }
...@@ -115,7 +115,7 @@ public class MaterialTextLayer : CATextLayer { ...@@ -115,7 +115,7 @@ public class MaterialTextLayer : CATextLayer {
/** /**
:name: x :name: x
*/ */
public var x: CGFloat { @IBInspectable public var x: CGFloat {
get { get {
return frame.origin.x return frame.origin.x
} }
...@@ -127,7 +127,7 @@ public class MaterialTextLayer : CATextLayer { ...@@ -127,7 +127,7 @@ public class MaterialTextLayer : CATextLayer {
/** /**
:name: y :name: y
*/ */
public var y: CGFloat { @IBInspectable public var y: CGFloat {
get { get {
return frame.origin.y return frame.origin.y
} }
...@@ -139,7 +139,7 @@ public class MaterialTextLayer : CATextLayer { ...@@ -139,7 +139,7 @@ public class MaterialTextLayer : CATextLayer {
/** /**
:name: width :name: width
*/ */
public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return frame.size.width return frame.size.width
} }
...@@ -151,7 +151,7 @@ public class MaterialTextLayer : CATextLayer { ...@@ -151,7 +151,7 @@ public class MaterialTextLayer : CATextLayer {
/** /**
:name: height :name: height
*/ */
public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return frame.size.height return frame.size.height
} }
......
...@@ -50,7 +50,7 @@ public class MaterialView : UIView { ...@@ -50,7 +50,7 @@ public class MaterialView : UIView {
property. Images should not be set to the backing layer's contents property. Images should not be set to the backing layer's contents
property to avoid conflicts when using clipsToBounds. property to avoid conflicts when using clipsToBounds.
*/ */
public var image: UIImage? { @IBInspectable public var image: UIImage? {
didSet { didSet {
visualLayer.contents = image?.CGImage visualLayer.contents = image?.CGImage
} }
...@@ -89,7 +89,7 @@ public class MaterialView : UIView { ...@@ -89,7 +89,7 @@ public class MaterialView : UIView {
dimensions of the visualLayer's contents property and the size dimensions of the visualLayer's contents property and the size
of the view. By default, this value is set to the MaterialDevice.scale. of the view. By default, this value is set to the MaterialDevice.scale.
*/ */
public var contentsScale: CGFloat { @IBInspectable public var contentsScale: CGFloat {
get { get {
return visualLayer.contentsScale return visualLayer.contentsScale
} }
...@@ -99,14 +99,14 @@ public class MaterialView : UIView { ...@@ -99,14 +99,14 @@ public class MaterialView : UIView {
} }
/// A Preset for the contentsGravity property. /// A Preset for the contentsGravity property.
public var contentsGravityPreset: MaterialGravity { @IBInspectable public var contentsGravityPreset: MaterialGravity {
didSet { didSet {
contentsGravity = MaterialGravityToString(contentsGravityPreset) contentsGravity = MaterialGravityToString(contentsGravityPreset)
} }
} }
/// Determines how content should be aligned within the visualLayer's bounds. /// Determines how content should be aligned within the visualLayer's bounds.
public var contentsGravity: String { @IBInspectable public var contentsGravity: String {
get { get {
return visualLayer.contentsGravity return visualLayer.contentsGravity
} }
...@@ -121,7 +121,7 @@ public class MaterialView : UIView { ...@@ -121,7 +121,7 @@ public class MaterialView : UIView {
the image property, then this value does not need to be set, since the the image property, then this value does not need to be set, since the
visualLayer's maskToBounds is set to true by default. visualLayer's maskToBounds is set to true by default.
*/ */
public var masksToBounds: Bool { @IBInspectable public var masksToBounds: Bool {
get { get {
return layer.masksToBounds return layer.masksToBounds
} }
...@@ -131,14 +131,14 @@ public class MaterialView : UIView { ...@@ -131,14 +131,14 @@ public class MaterialView : UIView {
} }
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's backgroundColor.
public override var backgroundColor: UIColor? { @IBInspectable public override var backgroundColor: UIColor? {
didSet { didSet {
layer.backgroundColor = backgroundColor?.CGColor layer.backgroundColor = backgroundColor?.CGColor
} }
} }
/// A property that accesses the layer.frame.origin.x property. /// A property that accesses the layer.frame.origin.x property.
public var x: CGFloat { @IBInspectable public var x: CGFloat {
get { get {
return layer.frame.origin.x return layer.frame.origin.x
} }
...@@ -148,7 +148,7 @@ public class MaterialView : UIView { ...@@ -148,7 +148,7 @@ public class MaterialView : UIView {
} }
/// A property that accesses the layer.frame.origin.y property. /// A property that accesses the layer.frame.origin.y property.
public var y: CGFloat { @IBInspectable public var y: CGFloat {
get { get {
return layer.frame.origin.y return layer.frame.origin.y
} }
...@@ -163,7 +163,7 @@ public class MaterialView : UIView { ...@@ -163,7 +163,7 @@ public class MaterialView : UIView {
value that is not .None, the height will be adjusted to maintain the correct value that is not .None, the height will be adjusted to maintain the correct
shape. shape.
*/ */
public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return layer.frame.size.width return layer.frame.size.width
} }
...@@ -181,7 +181,7 @@ public class MaterialView : UIView { ...@@ -181,7 +181,7 @@ public class MaterialView : UIView {
value that is not .None, the width will be adjusted to maintain the correct value that is not .None, the width will be adjusted to maintain the correct
shape. shape.
*/ */
public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return layer.frame.size.height return layer.frame.size.height
} }
...@@ -194,7 +194,7 @@ public class MaterialView : UIView { ...@@ -194,7 +194,7 @@ public class MaterialView : UIView {
} }
/// A property that accesses the backing layer's shadowColor. /// A property that accesses the backing layer's shadowColor.
public var shadowColor: UIColor? { @IBInspectable public var shadowColor: UIColor? {
didSet { didSet {
layer.shadowColor = shadowColor?.CGColor layer.shadowColor = shadowColor?.CGColor
} }
...@@ -211,7 +211,7 @@ public class MaterialView : UIView { ...@@ -211,7 +211,7 @@ public class MaterialView : UIView {
} }
/// A property that accesses the backing layer's shadowOpacity. /// A property that accesses the backing layer's shadowOpacity.
public var shadowOpacity: Float { @IBInspectable public var shadowOpacity: Float {
get { get {
return layer.shadowOpacity return layer.shadowOpacity
} }
...@@ -221,7 +221,7 @@ public class MaterialView : UIView { ...@@ -221,7 +221,7 @@ public class MaterialView : UIView {
} }
/// A property that accesses the backing layer's shadowRadius. /// A property that accesses the backing layer's shadowRadius.
public var shadowRadius: CGFloat { @IBInspectable public var shadowRadius: CGFloat {
get { get {
return layer.shadowRadius return layer.shadowRadius
} }
...@@ -241,7 +241,7 @@ public class MaterialView : UIView { ...@@ -241,7 +241,7 @@ public class MaterialView : UIView {
} }
/// Enables automatic shadowPath sizing. /// Enables automatic shadowPath sizing.
public var shadowPathAutoSizeEnabled: Bool = true { @IBInspectable public var shadowPathAutoSizeEnabled: Bool = true {
didSet { didSet {
if shadowPathAutoSizeEnabled { if shadowPathAutoSizeEnabled {
layoutShadowPath() layoutShadowPath()
...@@ -280,7 +280,7 @@ public class MaterialView : UIView { ...@@ -280,7 +280,7 @@ public class MaterialView : UIView {
} }
/// A property that accesses the layer.cornerRadius. /// A property that accesses the layer.cornerRadius.
public var cornerRadius: CGFloat { @IBInspectable public var cornerRadius: CGFloat {
get { get {
return layer.cornerRadius return layer.cornerRadius
} }
...@@ -319,7 +319,7 @@ public class MaterialView : UIView { ...@@ -319,7 +319,7 @@ public class MaterialView : UIView {
} }
/// A property that accesses the layer.borderWith. /// A property that accesses the layer.borderWith.
public var borderWidth: CGFloat { @IBInspectable public var borderWidth: CGFloat {
get { get {
return layer.borderWidth return layer.borderWidth
} }
...@@ -329,7 +329,7 @@ public class MaterialView : UIView { ...@@ -329,7 +329,7 @@ public class MaterialView : UIView {
} }
/// A property that accesses the layer.borderColor property. /// A property that accesses the layer.borderColor property.
public var borderColor: UIColor? { @IBInspectable public var borderColor: UIColor? {
get { get {
return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!) return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!)
} }
...@@ -339,7 +339,7 @@ public class MaterialView : UIView { ...@@ -339,7 +339,7 @@ public class MaterialView : UIView {
} }
/// A property that accesses the layer.position property. /// A property that accesses the layer.position property.
public var position: CGPoint { @IBInspectable public var position: CGPoint {
get { get {
return layer.position return layer.position
} }
...@@ -349,7 +349,7 @@ public class MaterialView : UIView { ...@@ -349,7 +349,7 @@ public class MaterialView : UIView {
} }
/// A property that accesses the layer.zPosition property. /// A property that accesses the layer.zPosition property.
public var zPosition: CGFloat { @IBInspectable public var zPosition: CGFloat {
get { get {
return layer.zPosition return layer.zPosition
} }
......
...@@ -56,7 +56,7 @@ public class MenuViewController: UIViewController { ...@@ -56,7 +56,7 @@ public class MenuViewController: UIViewController {
A Boolean property used to enable and disable interactivity A Boolean property used to enable and disable interactivity
with the mainViewController. with the mainViewController.
*/ */
public var userInteractionEnabled: Bool { @IBInspectable public var userInteractionEnabled: Bool {
get { get {
return mainViewController.view.userInteractionEnabled return mainViewController.view.userInteractionEnabled
} }
......
...@@ -50,11 +50,15 @@ public class NavigationBar : UINavigationBar { ...@@ -50,11 +50,15 @@ public class NavigationBar : UINavigationBar {
The back button image writes to the backIndicatorImage property and The back button image writes to the backIndicatorImage property and
backIndicatorTransitionMaskImage property. backIndicatorTransitionMaskImage property.
*/ */
public var backButtonImage: UIImage? { @IBInspectable public var backButtonImage: UIImage? {
didSet { didSet {
if nil == backButtonImage { if nil == backButtonImage {
backButtonImage = MaterialIcon.arrowBack backButtonImage = MaterialIcon.arrowBack
} }
backIndicatorImage = backButtonImage
backIndicatorTransitionMaskImage = backButtonImage
backButton.setImage(backButtonImage, forState: .Normal)
backButton.setImage(backButtonImage, forState: .Highlighted)
} }
} }
...@@ -78,7 +82,7 @@ public class NavigationBar : UINavigationBar { ...@@ -78,7 +82,7 @@ public class NavigationBar : UINavigationBar {
the image property, then this value does not need to be set, since the the image property, then this value does not need to be set, since the
visualLayer's maskToBounds is set to true by default. visualLayer's maskToBounds is set to true by default.
*/ */
public var masksToBounds: Bool { @IBInspectable public var masksToBounds: Bool {
get { get {
return layer.masksToBounds return layer.masksToBounds
} }
...@@ -88,14 +92,14 @@ public class NavigationBar : UINavigationBar { ...@@ -88,14 +92,14 @@ public class NavigationBar : UINavigationBar {
} }
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's backgroundColor.
public override var backgroundColor: UIColor? { @IBInspectable public override var backgroundColor: UIColor? {
didSet { didSet {
barTintColor = backgroundColor barTintColor = backgroundColor
} }
} }
/// A property that accesses the layer.frame.origin.x property. /// A property that accesses the layer.frame.origin.x property.
public var x: CGFloat { @IBInspectable public var x: CGFloat {
get { get {
return layer.frame.origin.x return layer.frame.origin.x
} }
...@@ -105,7 +109,7 @@ public class NavigationBar : UINavigationBar { ...@@ -105,7 +109,7 @@ public class NavigationBar : UINavigationBar {
} }
/// A property that accesses the layer.frame.origin.y property. /// A property that accesses the layer.frame.origin.y property.
public var y: CGFloat { @IBInspectable public var y: CGFloat {
get { get {
return layer.frame.origin.y return layer.frame.origin.y
} }
...@@ -120,7 +124,7 @@ public class NavigationBar : UINavigationBar { ...@@ -120,7 +124,7 @@ public class NavigationBar : UINavigationBar {
value that is not .None, the height will be adjusted to maintain the correct value that is not .None, the height will be adjusted to maintain the correct
shape. shape.
*/ */
public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return layer.frame.size.width return layer.frame.size.width
} }
...@@ -135,7 +139,7 @@ public class NavigationBar : UINavigationBar { ...@@ -135,7 +139,7 @@ public class NavigationBar : UINavigationBar {
value that is not .None, the width will be adjusted to maintain the correct value that is not .None, the width will be adjusted to maintain the correct
shape. shape.
*/ */
public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return layer.frame.size.height return layer.frame.size.height
} }
...@@ -145,7 +149,7 @@ public class NavigationBar : UINavigationBar { ...@@ -145,7 +149,7 @@ public class NavigationBar : UINavigationBar {
} }
/// A property that accesses the backing layer's shadowColor. /// A property that accesses the backing layer's shadowColor.
public var shadowColor: UIColor? { @IBInspectable public var shadowColor: UIColor? {
didSet { didSet {
layer.shadowColor = shadowColor?.CGColor layer.shadowColor = shadowColor?.CGColor
} }
...@@ -162,7 +166,7 @@ public class NavigationBar : UINavigationBar { ...@@ -162,7 +166,7 @@ public class NavigationBar : UINavigationBar {
} }
/// A property that accesses the backing layer's shadowOpacity. /// A property that accesses the backing layer's shadowOpacity.
public var shadowOpacity: Float { @IBInspectable public var shadowOpacity: Float {
get { get {
return layer.shadowOpacity return layer.shadowOpacity
} }
...@@ -172,7 +176,7 @@ public class NavigationBar : UINavigationBar { ...@@ -172,7 +176,7 @@ public class NavigationBar : UINavigationBar {
} }
/// A property that accesses the backing layer's shadowRadius. /// A property that accesses the backing layer's shadowRadius.
public var shadowRadius: CGFloat { @IBInspectable public var shadowRadius: CGFloat {
get { get {
return layer.shadowRadius return layer.shadowRadius
} }
...@@ -203,7 +207,7 @@ public class NavigationBar : UINavigationBar { ...@@ -203,7 +207,7 @@ public class NavigationBar : UINavigationBar {
} }
/// A property that accesses the layer.borderWith. /// A property that accesses the layer.borderWith.
public var borderWidth: CGFloat { @IBInspectable public var borderWidth: CGFloat {
get { get {
return layer.borderWidth return layer.borderWidth
} }
...@@ -213,7 +217,7 @@ public class NavigationBar : UINavigationBar { ...@@ -213,7 +217,7 @@ public class NavigationBar : UINavigationBar {
} }
/// A property that accesses the layer.borderColor property. /// A property that accesses the layer.borderColor property.
public var borderColor: UIColor? { @IBInspectable public var borderColor: UIColor? {
get { get {
return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!) return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!)
} }
......
...@@ -66,7 +66,7 @@ public protocol NavigationBarViewControllerDelegate : MaterialDelegate { ...@@ -66,7 +66,7 @@ public protocol NavigationBarViewControllerDelegate : MaterialDelegate {
@objc(NavigationBarViewController) @objc(NavigationBarViewController)
public class NavigationBarViewController: StatusBarViewController { public class NavigationBarViewController: StatusBarViewController {
/// The height of the StatusBar. /// The height of the StatusBar.
public override var heightForStatusBar: CGFloat { @IBInspectable public override var heightForStatusBar: CGFloat {
get { get {
return navigationBarView.heightForStatusBar return navigationBarView.heightForStatusBar
} }
...@@ -76,7 +76,7 @@ public class NavigationBarViewController: StatusBarViewController { ...@@ -76,7 +76,7 @@ public class NavigationBarViewController: StatusBarViewController {
} }
/// The height when in Portrait orientation mode. /// The height when in Portrait orientation mode.
public override var heightForPortraitOrientation: CGFloat { @IBInspectable public override var heightForPortraitOrientation: CGFloat {
get { get {
return navigationBarView.heightForPortraitOrientation return navigationBarView.heightForPortraitOrientation
} }
...@@ -86,7 +86,7 @@ public class NavigationBarViewController: StatusBarViewController { ...@@ -86,7 +86,7 @@ public class NavigationBarViewController: StatusBarViewController {
} }
/// The height when in Landscape orientation mode. /// The height when in Landscape orientation mode.
public override var heightForLandscapeOrientation: CGFloat { @IBInspectable public override var heightForLandscapeOrientation: CGFloat {
get { get {
return navigationBarView.heightForLandscapeOrientation return navigationBarView.heightForLandscapeOrientation
} }
......
...@@ -45,28 +45,28 @@ public class SearchBarView : StatusBarView { ...@@ -45,28 +45,28 @@ public class SearchBarView : StatusBarView {
} }
/// TintColor for searchBar. /// TintColor for searchBar.
public override var tintColor: UIColor? { @IBInspectable public override var tintColor: UIColor? {
didSet { didSet {
textField.tintColor = tintColor textField.tintColor = tintColor
} }
} }
/// TextColor for searchBar. /// TextColor for searchBar.
public var textColor: UIColor? { @IBInspectable public var textColor: UIColor? {
didSet { didSet {
textField.textColor = textColor textField.textColor = textColor
} }
} }
/// A wrapper for searchBar.placeholder. /// A wrapper for searchBar.placeholder.
public var placeholder: String? { @IBInspectable public var placeholder: String? {
didSet { didSet {
textField.placeholder = placeholder textField.placeholder = placeholder
} }
} }
/// Placeholder textColor. /// Placeholder textColor.
public var placeholderTextColor: UIColor { @IBInspectable public var placeholderTextColor: UIColor {
get { get {
return textField.placeholderTextColor return textField.placeholderTextColor
} }
......
...@@ -50,7 +50,7 @@ public extension UIViewController { ...@@ -50,7 +50,7 @@ public extension UIViewController {
public class SearchBarViewController: StatusBarViewController { public class SearchBarViewController: StatusBarViewController {
/// The height of the StatusBar. /// The height of the StatusBar.
public override var heightForStatusBar: CGFloat { @IBInspectable public override var heightForStatusBar: CGFloat {
get { get {
return searchBarView.heightForStatusBar return searchBarView.heightForStatusBar
} }
...@@ -60,7 +60,7 @@ public class SearchBarViewController: StatusBarViewController { ...@@ -60,7 +60,7 @@ public class SearchBarViewController: StatusBarViewController {
} }
/// The height when in Portrait orientation mode. /// The height when in Portrait orientation mode.
public override var heightForPortraitOrientation: CGFloat { @IBInspectable public override var heightForPortraitOrientation: CGFloat {
get { get {
return searchBarView.heightForPortraitOrientation return searchBarView.heightForPortraitOrientation
} }
...@@ -70,7 +70,7 @@ public class SearchBarViewController: StatusBarViewController { ...@@ -70,7 +70,7 @@ public class SearchBarViewController: StatusBarViewController {
} }
/// The height when in Landscape orientation mode. /// The height when in Landscape orientation mode.
public override var heightForLandscapeOrientation: CGFloat { @IBInspectable public override var heightForLandscapeOrientation: CGFloat {
get { get {
return searchBarView.heightForLandscapeOrientation return searchBarView.heightForLandscapeOrientation
} }
......
...@@ -139,7 +139,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -139,7 +139,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
leftView is closed. The leftViewThreshold is always at half leftView is closed. The leftViewThreshold is always at half
the width of the leftView. the width of the leftView.
*/ */
public private(set) var leftViewThreshold: CGFloat = 0 @IBInspectable public var leftViewThreshold: CGFloat = 0
/** /**
A CGFloat property that accesses the rightView threshold of A CGFloat property that accesses the rightView threshold of
...@@ -149,7 +149,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -149,7 +149,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
rightView is opened. The rightViewThreshold is always at half rightView is opened. The rightViewThreshold is always at half
the width of the rightView. the width of the rightView.
*/ */
public private(set) var rightViewThreshold: CGFloat = 0 @IBInspectable public var rightViewThreshold: CGFloat = 0
/** /**
A SideNavigationViewControllerDelegate property used to bind A SideNavigationViewControllerDelegate property used to bind
...@@ -161,7 +161,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -161,7 +161,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
A Boolean property used to enable and disable interactivity A Boolean property used to enable and disable interactivity
with the mainViewController. with the mainViewController.
*/ */
public var userInteractionEnabled: Bool { @IBInspectable public var userInteractionEnabled: Bool {
get { get {
return mainViewController.view.userInteractionEnabled return mainViewController.view.userInteractionEnabled
} }
...@@ -174,13 +174,13 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -174,13 +174,13 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
A CGFloat property that sets the animation duration of the A CGFloat property that sets the animation duration of the
leftView when closing and opening. Defaults to 0.25. leftView when closing and opening. Defaults to 0.25.
*/ */
public var animationDuration: CGFloat = 0.25 @IBInspectable public var animationDuration: CGFloat = 0.25
/** /**
A Boolean property that enables and disables the leftView from A Boolean property that enables and disables the leftView from
opening and closing. Defaults to true. opening and closing. Defaults to true.
*/ */
public var enabled: Bool { @IBInspectable public var enabled: Bool {
get { get {
return enabledLeftView || enabledRightView return enabledLeftView || enabledRightView
} }
...@@ -198,19 +198,19 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -198,19 +198,19 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
A Boolean property that enables and disables the leftView from A Boolean property that enables and disables the leftView from
opening and closing. Defaults to true. opening and closing. Defaults to true.
*/ */
public var enabledLeftView: Bool = true @IBInspectable public var enabledLeftView: Bool = true
/** /**
A Boolean property that enables and disables the rightView from A Boolean property that enables and disables the rightView from
opening and closing. Defaults to true. opening and closing. Defaults to true.
*/ */
public var enabledRightView: Bool = true @IBInspectable public var enabledRightView: Bool = true
/** /**
A Boolean property that triggers the status bar to be hidden A Boolean property that triggers the status bar to be hidden
when the leftView is opened. Defaults to true. when the leftView is opened. Defaults to true.
*/ */
public var hideStatusBar: Bool = true @IBInspectable public var hideStatusBar: Bool = true
/** /**
A MaterialDepth property that is used to set the depth of the A MaterialDepth property that is used to set the depth of the
...@@ -277,13 +277,13 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -277,13 +277,13 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
A CGFloat property to access the width that the leftView A CGFloat property to access the width that the leftView
opens up to. opens up to.
*/ */
public private(set) var leftViewWidth: CGFloat = 240 @IBInspectable public private(set) var leftViewWidth: CGFloat = 240
/** /**
A CGFloat property to access the width that the rightView A CGFloat property to access the width that the rightView
opens up to. opens up to.
*/ */
public private(set) var rightViewWidth: CGFloat = 240 @IBInspectable public private(set) var rightViewWidth: CGFloat = 240
/** /**
An initializer for the SideNavigationViewController. An initializer for the SideNavigationViewController.
......
...@@ -32,13 +32,13 @@ import UIKit ...@@ -32,13 +32,13 @@ import UIKit
public class StatusBarView : ControlView { public class StatusBarView : ControlView {
/// The height of the StatusBar. /// The height of the StatusBar.
public var heightForStatusBar: CGFloat = 20 @IBInspectable public var heightForStatusBar: CGFloat = 20
/// The height when in Portrait orientation mode. /// The height when in Portrait orientation mode.
public var heightForPortraitOrientation: CGFloat = 64 @IBInspectable public var heightForPortraitOrientation: CGFloat = 64
/// The height when in Landscape orientation mode. /// The height when in Landscape orientation mode.
public var heightForLandscapeOrientation: CGFloat = 44 @IBInspectable public var heightForLandscapeOrientation: CGFloat = 44
/// Device status bar style. /// Device status bar style.
public var statusBarStyle: UIStatusBarStyle { public var statusBarStyle: UIStatusBarStyle {
......
...@@ -32,19 +32,19 @@ import UIKit ...@@ -32,19 +32,19 @@ import UIKit
public class StatusBarViewController: UIViewController { public class StatusBarViewController: UIViewController {
/// The height of the StatusBar. /// The height of the StatusBar.
public var heightForStatusBar: CGFloat = 20 @IBInspectable public var heightForStatusBar: CGFloat = 20
/// The height when in Portrait orientation mode. /// The height when in Portrait orientation mode.
public var heightForPortraitOrientation: CGFloat = 64 @IBInspectable public var heightForPortraitOrientation: CGFloat = 64
/// The height when in Landscape orientation mode. /// The height when in Landscape orientation mode.
public var heightForLandscapeOrientation: CGFloat = 44 @IBInspectable public var heightForLandscapeOrientation: CGFloat = 44
/** /**
A Boolean property used to enable and disable interactivity A Boolean property used to enable and disable interactivity
with the mainViewController. with the mainViewController.
*/ */
public var userInteractionEnabled: Bool { @IBInspectable public var userInteractionEnabled: Bool {
get { get {
return mainViewController.view.userInteractionEnabled return mainViewController.view.userInteractionEnabled
} }
......
...@@ -37,7 +37,7 @@ public class TextField : UITextField { ...@@ -37,7 +37,7 @@ public class TextField : UITextField {
This property is the same as clipsToBounds. It crops any of the view's This property is the same as clipsToBounds. It crops any of the view's
contents from bleeding past the view's frame. contents from bleeding past the view's frame.
*/ */
public var masksToBounds: Bool { @IBInspectable public var masksToBounds: Bool {
get { get {
return layer.masksToBounds return layer.masksToBounds
} }
...@@ -47,14 +47,14 @@ public class TextField : UITextField { ...@@ -47,14 +47,14 @@ public class TextField : UITextField {
} }
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's backgroundColor.
public override var backgroundColor: UIColor? { @IBInspectable public override var backgroundColor: UIColor? {
didSet { didSet {
layer.backgroundColor = backgroundColor?.CGColor layer.backgroundColor = backgroundColor?.CGColor
} }
} }
/// A property that accesses the layer.frame.origin.x property. /// A property that accesses the layer.frame.origin.x property.
public var x: CGFloat { @IBInspectable public var x: CGFloat {
get { get {
return layer.frame.origin.x return layer.frame.origin.x
} }
...@@ -64,7 +64,7 @@ public class TextField : UITextField { ...@@ -64,7 +64,7 @@ public class TextField : UITextField {
} }
/// A property that accesses the layer.frame.origin.y property. /// A property that accesses the layer.frame.origin.y property.
public var y: CGFloat { @IBInspectable public var y: CGFloat {
get { get {
return layer.frame.origin.y return layer.frame.origin.y
} }
...@@ -79,7 +79,7 @@ public class TextField : UITextField { ...@@ -79,7 +79,7 @@ public class TextField : UITextField {
value that is not .None, the height will be adjusted to maintain the correct value that is not .None, the height will be adjusted to maintain the correct
shape. shape.
*/ */
public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return layer.frame.size.width return layer.frame.size.width
} }
...@@ -97,7 +97,7 @@ public class TextField : UITextField { ...@@ -97,7 +97,7 @@ public class TextField : UITextField {
value that is not .None, the width will be adjusted to maintain the correct value that is not .None, the width will be adjusted to maintain the correct
shape. shape.
*/ */
public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return layer.frame.size.height return layer.frame.size.height
} }
...@@ -110,7 +110,7 @@ public class TextField : UITextField { ...@@ -110,7 +110,7 @@ public class TextField : UITextField {
} }
/// A property that accesses the backing layer's shadowColor. /// A property that accesses the backing layer's shadowColor.
public var shadowColor: UIColor? { @IBInspectable public var shadowColor: UIColor? {
didSet { didSet {
layer.shadowColor = shadowColor?.CGColor layer.shadowColor = shadowColor?.CGColor
} }
...@@ -127,7 +127,7 @@ public class TextField : UITextField { ...@@ -127,7 +127,7 @@ public class TextField : UITextField {
} }
/// A property that accesses the backing layer's shadowOpacity. /// A property that accesses the backing layer's shadowOpacity.
public var shadowOpacity: Float { @IBInspectable public var shadowOpacity: Float {
get { get {
return layer.shadowOpacity return layer.shadowOpacity
} }
...@@ -137,7 +137,7 @@ public class TextField : UITextField { ...@@ -137,7 +137,7 @@ public class TextField : UITextField {
} }
/// A property that accesses the backing layer's shadowRadius. /// A property that accesses the backing layer's shadowRadius.
public var shadowRadius: CGFloat { @IBInspectable public var shadowRadius: CGFloat {
get { get {
return layer.shadowRadius return layer.shadowRadius
} }
...@@ -157,7 +157,7 @@ public class TextField : UITextField { ...@@ -157,7 +157,7 @@ public class TextField : UITextField {
} }
/// Enables automatic shadowPath sizing. /// Enables automatic shadowPath sizing.
public var shadowPathAutoSizeEnabled: Bool = true { @IBInspectable public var shadowPathAutoSizeEnabled: Bool = true {
didSet { didSet {
if shadowPathAutoSizeEnabled { if shadowPathAutoSizeEnabled {
layoutShadowPath() layoutShadowPath()
...@@ -196,7 +196,7 @@ public class TextField : UITextField { ...@@ -196,7 +196,7 @@ public class TextField : UITextField {
} }
/// A property that accesses the layer.cornerRadius. /// A property that accesses the layer.cornerRadius.
public var cornerRadius: CGFloat { @IBInspectable public var cornerRadius: CGFloat {
get { get {
return layer.cornerRadius return layer.cornerRadius
} }
...@@ -235,7 +235,7 @@ public class TextField : UITextField { ...@@ -235,7 +235,7 @@ public class TextField : UITextField {
} }
/// A property that accesses the layer.borderWith. /// A property that accesses the layer.borderWith.
public var borderWidth: CGFloat { @IBInspectable public var borderWidth: CGFloat {
get { get {
return layer.borderWidth return layer.borderWidth
} }
...@@ -245,7 +245,7 @@ public class TextField : UITextField { ...@@ -245,7 +245,7 @@ public class TextField : UITextField {
} }
/// A property that accesses the layer.borderColor property. /// A property that accesses the layer.borderColor property.
public var borderColor: UIColor? { @IBInspectable public var borderColor: UIColor? {
get { get {
return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!) return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!)
} }
...@@ -255,7 +255,7 @@ public class TextField : UITextField { ...@@ -255,7 +255,7 @@ public class TextField : UITextField {
} }
/// A property that accesses the layer.position property. /// A property that accesses the layer.position property.
public var position: CGPoint { @IBInspectable public var position: CGPoint {
get { get {
return layer.position return layer.position
} }
...@@ -265,7 +265,7 @@ public class TextField : UITextField { ...@@ -265,7 +265,7 @@ public class TextField : UITextField {
} }
/// A property that accesses the layer.zPosition property. /// A property that accesses the layer.zPosition property.
public var zPosition: CGFloat { @IBInspectable public var zPosition: CGFloat {
get { get {
return layer.zPosition return layer.zPosition
} }
...@@ -298,7 +298,7 @@ public class TextField : UITextField { ...@@ -298,7 +298,7 @@ public class TextField : UITextField {
A property that sets the distance between the textField and A property that sets the distance between the textField and
bottomBorderLayer. bottomBorderLayer.
*/ */
public var bottomBorderLayerDistance: CGFloat = 4 @IBInspectable public var bottomBorderLayerDistance: CGFloat = 4
/** /**
The title UILabel that is displayed when there is text. The The title UILabel that is displayed when there is text. The
...@@ -312,7 +312,7 @@ public class TextField : UITextField { ...@@ -312,7 +312,7 @@ public class TextField : UITextField {
} }
/// The color of the titleLabel text when the textField is not active. /// The color of the titleLabel text when the textField is not active.
public var titleLabelColor: UIColor? { @IBInspectable public var titleLabelColor: UIColor? {
didSet { didSet {
titleLabel?.textColor = titleLabelColor titleLabel?.textColor = titleLabelColor
MaterialAnimation.animationDisabled { [unowned self] in MaterialAnimation.animationDisabled { [unowned self] in
...@@ -322,16 +322,16 @@ public class TextField : UITextField { ...@@ -322,16 +322,16 @@ public class TextField : UITextField {
} }
/// The color of the titleLabel text when the textField is active. /// The color of the titleLabel text when the textField is active.
public var titleLabelActiveColor: UIColor? @IBInspectable public var titleLabelActiveColor: UIColor?
/** /**
A property that sets the distance between the textField and A property that sets the distance between the textField and
titleLabel. titleLabel.
*/ */
public var titleLabelAnimationDistance: CGFloat = 8 @IBInspectable public var titleLabelAnimationDistance: CGFloat = 8
/// An override to the text property. /// An override to the text property.
public override var text: String? { @IBInspectable public override var text: String? {
didSet { didSet {
textFieldDidChange() textFieldDidChange()
} }
...@@ -351,7 +351,7 @@ public class TextField : UITextField { ...@@ -351,7 +351,7 @@ public class TextField : UITextField {
The color of the detailLabel text when the detailLabelHidden property The color of the detailLabel text when the detailLabelHidden property
is set to false. is set to false.
*/ */
public var detailLabelActiveColor: UIColor? { @IBInspectable public var detailLabelActiveColor: UIColor? {
didSet { didSet {
if !detailLabelHidden { if !detailLabelHidden {
detailLabel?.textColor = detailLabelActiveColor detailLabel?.textColor = detailLabelActiveColor
...@@ -366,18 +366,18 @@ public class TextField : UITextField { ...@@ -366,18 +366,18 @@ public class TextField : UITextField {
A property that sets the distance between the textField and A property that sets the distance between the textField and
detailLabel. detailLabel.
*/ */
public var detailLabelAnimationDistance: CGFloat = 8 @IBInspectable public var detailLabelAnimationDistance: CGFloat = 8
/** /**
A Boolean that indicates the detailLabel should hide A Boolean that indicates the detailLabel should hide
automatically when text changes. automatically when text changes.
*/ */
public var detailLabelAutoHideEnabled: Bool = true @IBInspectable public var detailLabelAutoHideEnabled: Bool = true
/** /**
:name: detailLabelHidden :name: detailLabelHidden
*/ */
public var detailLabelHidden: Bool = true { @IBInspectable public var detailLabelHidden: Bool = true {
didSet { didSet {
if detailLabelHidden { if detailLabelHidden {
detailLabel?.textColor = titleLabelColor detailLabel?.textColor = titleLabelColor
...@@ -396,7 +396,7 @@ public class TextField : UITextField { ...@@ -396,7 +396,7 @@ public class TextField : UITextField {
} }
/// A wrapper for searchBar.placeholder. /// A wrapper for searchBar.placeholder.
public override var placeholder: String? { @IBInspectable public override var placeholder: String? {
didSet { didSet {
if let v: String = placeholder { if let v: String = placeholder {
attributedPlaceholder = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderTextColor]) attributedPlaceholder = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderTextColor])
...@@ -405,7 +405,7 @@ public class TextField : UITextField { ...@@ -405,7 +405,7 @@ public class TextField : UITextField {
} }
/// Placeholder textColor. /// Placeholder textColor.
public var placeholderTextColor: UIColor = MaterialColor.black { @IBInspectable public var placeholderTextColor: UIColor = MaterialColor.black {
didSet { didSet {
if let v: String = placeholder { if let v: String = placeholder {
attributedPlaceholder = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderTextColor]) attributedPlaceholder = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderTextColor])
......
...@@ -39,7 +39,7 @@ public class TextView: UITextView { ...@@ -39,7 +39,7 @@ public class TextView: UITextView {
This property is the same as clipsToBounds. It crops any of the view's This property is the same as clipsToBounds. It crops any of the view's
contents from bleeding past the view's frame. contents from bleeding past the view's frame.
*/ */
public var masksToBounds: Bool { @IBInspectable public var masksToBounds: Bool {
get { get {
return layer.masksToBounds return layer.masksToBounds
} }
...@@ -49,14 +49,14 @@ public class TextView: UITextView { ...@@ -49,14 +49,14 @@ public class TextView: UITextView {
} }
/// A property that accesses the backing layer's backgroundColor. /// A property that accesses the backing layer's backgroundColor.
public override var backgroundColor: UIColor? { @IBInspectable public override var backgroundColor: UIColor? {
didSet { didSet {
layer.backgroundColor = backgroundColor?.CGColor layer.backgroundColor = backgroundColor?.CGColor
} }
} }
/// A property that accesses the layer.frame.origin.x property. /// A property that accesses the layer.frame.origin.x property.
public var x: CGFloat { @IBInspectable public var x: CGFloat {
get { get {
return layer.frame.origin.x return layer.frame.origin.x
} }
...@@ -66,7 +66,7 @@ public class TextView: UITextView { ...@@ -66,7 +66,7 @@ public class TextView: UITextView {
} }
/// A property that accesses the layer.frame.origin.y property. /// A property that accesses the layer.frame.origin.y property.
public var y: CGFloat { @IBInspectable public var y: CGFloat {
get { get {
return layer.frame.origin.y return layer.frame.origin.y
} }
...@@ -81,7 +81,7 @@ public class TextView: UITextView { ...@@ -81,7 +81,7 @@ public class TextView: UITextView {
value that is not .None, the height will be adjusted to maintain the correct value that is not .None, the height will be adjusted to maintain the correct
shape. shape.
*/ */
public var width: CGFloat { @IBInspectable public var width: CGFloat {
get { get {
return layer.frame.size.width return layer.frame.size.width
} }
...@@ -99,7 +99,7 @@ public class TextView: UITextView { ...@@ -99,7 +99,7 @@ public class TextView: UITextView {
value that is not .None, the width will be adjusted to maintain the correct value that is not .None, the width will be adjusted to maintain the correct
shape. shape.
*/ */
public var height: CGFloat { @IBInspectable public var height: CGFloat {
get { get {
return layer.frame.size.height return layer.frame.size.height
} }
...@@ -112,7 +112,7 @@ public class TextView: UITextView { ...@@ -112,7 +112,7 @@ public class TextView: UITextView {
} }
/// A property that accesses the backing layer's shadowColor. /// A property that accesses the backing layer's shadowColor.
public var shadowColor: UIColor? { @IBInspectable public var shadowColor: UIColor? {
didSet { didSet {
layer.shadowColor = shadowColor?.CGColor layer.shadowColor = shadowColor?.CGColor
} }
...@@ -129,7 +129,7 @@ public class TextView: UITextView { ...@@ -129,7 +129,7 @@ public class TextView: UITextView {
} }
/// A property that accesses the backing layer's shadowOpacity. /// A property that accesses the backing layer's shadowOpacity.
public var shadowOpacity: Float { @IBInspectable public var shadowOpacity: Float {
get { get {
return layer.shadowOpacity return layer.shadowOpacity
} }
...@@ -139,7 +139,7 @@ public class TextView: UITextView { ...@@ -139,7 +139,7 @@ public class TextView: UITextView {
} }
/// A property that accesses the backing layer's shadowRadius. /// A property that accesses the backing layer's shadowRadius.
public var shadowRadius: CGFloat { @IBInspectable public var shadowRadius: CGFloat {
get { get {
return layer.shadowRadius return layer.shadowRadius
} }
...@@ -159,7 +159,7 @@ public class TextView: UITextView { ...@@ -159,7 +159,7 @@ public class TextView: UITextView {
} }
/// Enables automatic shadowPath sizing. /// Enables automatic shadowPath sizing.
public var shadowPathAutoSizeEnabled: Bool = true { @IBInspectable public var shadowPathAutoSizeEnabled: Bool = true {
didSet { didSet {
if shadowPathAutoSizeEnabled { if shadowPathAutoSizeEnabled {
layoutShadowPath() layoutShadowPath()
...@@ -198,7 +198,7 @@ public class TextView: UITextView { ...@@ -198,7 +198,7 @@ public class TextView: UITextView {
} }
/// A property that accesses the layer.cornerRadius. /// A property that accesses the layer.cornerRadius.
public var cornerRadius: CGFloat { @IBInspectable public var cornerRadius: CGFloat {
get { get {
return layer.cornerRadius return layer.cornerRadius
} }
...@@ -237,7 +237,7 @@ public class TextView: UITextView { ...@@ -237,7 +237,7 @@ public class TextView: UITextView {
} }
/// A property that accesses the layer.borderWith. /// A property that accesses the layer.borderWith.
public var borderWidth: CGFloat { @IBInspectable public var borderWidth: CGFloat {
get { get {
return layer.borderWidth return layer.borderWidth
} }
...@@ -247,7 +247,7 @@ public class TextView: UITextView { ...@@ -247,7 +247,7 @@ public class TextView: UITextView {
} }
/// A property that accesses the layer.borderColor property. /// A property that accesses the layer.borderColor property.
public var borderColor: UIColor? { @IBInspectable public var borderColor: UIColor? {
get { get {
return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!) return nil == layer.borderColor ? nil : UIColor(CGColor: layer.borderColor!)
} }
...@@ -267,7 +267,7 @@ public class TextView: UITextView { ...@@ -267,7 +267,7 @@ public class TextView: UITextView {
} }
/// A property that accesses the layer.zPosition property. /// A property that accesses the layer.zPosition property.
public var zPosition: CGFloat { @IBInspectable public var zPosition: CGFloat {
get { get {
return layer.zPosition return layer.zPosition
} }
...@@ -288,20 +288,20 @@ public class TextView: UITextView { ...@@ -288,20 +288,20 @@ public class TextView: UITextView {
} }
/// The color of the titleLabel text when the textView is not active. /// The color of the titleLabel text when the textView is not active.
public var titleLabelColor: UIColor? { @IBInspectable public var titleLabelColor: UIColor? {
didSet { didSet {
titleLabel?.textColor = titleLabelColor titleLabel?.textColor = titleLabelColor
} }
} }
/// The color of the titleLabel text when the textView is active. /// The color of the titleLabel text when the textView is active.
public var titleLabelActiveColor: UIColor? @IBInspectable public var titleLabelActiveColor: UIColor?
/** /**
A property that sets the distance between the textView and A property that sets the distance between the textView and
titleLabel. titleLabel.
*/ */
public var titleLabelAnimationDistance: CGFloat = 8 @IBInspectable public var titleLabelAnimationDistance: CGFloat = 8
/// Placeholder UILabel view. /// Placeholder UILabel view.
public var placeholderLabel: UILabel? { public var placeholderLabel: UILabel? {
...@@ -311,7 +311,7 @@ public class TextView: UITextView { ...@@ -311,7 +311,7 @@ public class TextView: UITextView {
} }
/// An override to the text property. /// An override to the text property.
public override var text: String! { @IBInspectable public override var text: String! {
didSet { didSet {
handleTextViewTextDidChange() handleTextViewTextDidChange()
} }
......
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