Commit e1fdce7a by Daniel Dahan

progression commit with MaterialDepth now Depth and added DepthPreset

parent 0ece8ac0
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
96BCB7BE1CB40DC500C806FE /* MaterialCollectionViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7751CB40DC500C806FE /* MaterialCollectionViewLayout.swift */; }; 96BCB7BE1CB40DC500C806FE /* MaterialCollectionViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7751CB40DC500C806FE /* MaterialCollectionViewLayout.swift */; };
96BCB7BF1CB40DC500C806FE /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7761CB40DC500C806FE /* Color.swift */; }; 96BCB7BF1CB40DC500C806FE /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7761CB40DC500C806FE /* Color.swift */; };
96BCB7C01CB40DC500C806FE /* MaterialDataSourceItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7771CB40DC500C806FE /* MaterialDataSourceItem.swift */; }; 96BCB7C01CB40DC500C806FE /* MaterialDataSourceItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7771CB40DC500C806FE /* MaterialDataSourceItem.swift */; };
96BCB7C11CB40DC500C806FE /* MaterialDepth.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7781CB40DC500C806FE /* MaterialDepth.swift */; }; 96BCB7C11CB40DC500C806FE /* Depth.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7781CB40DC500C806FE /* Depth.swift */; };
96BCB7C21CB40DC500C806FE /* Device.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7791CB40DC500C806FE /* Device.swift */; }; 96BCB7C21CB40DC500C806FE /* Device.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7791CB40DC500C806FE /* Device.swift */; };
96BCB7C31CB40DC500C806FE /* Insets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77A1CB40DC500C806FE /* Insets.swift */; }; 96BCB7C31CB40DC500C806FE /* Insets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77A1CB40DC500C806FE /* Insets.swift */; };
96BCB7C41CB40DC500C806FE /* Font.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77B1CB40DC500C806FE /* Font.swift */; }; 96BCB7C41CB40DC500C806FE /* Font.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77B1CB40DC500C806FE /* Font.swift */; };
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
96BCB84C1CB4115200C806FE /* TextView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB79E1CB40DC500C806FE /* TextView.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB84C1CB4115200C806FE /* TextView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB79E1CB40DC500C806FE /* TextView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB84D1CB4115200C806FE /* MaterialBorder.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB76F1CB40DC500C806FE /* MaterialBorder.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB84D1CB4115200C806FE /* MaterialBorder.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB76F1CB40DC500C806FE /* MaterialBorder.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB84E1CB4115200C806FE /* InterimSpace.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7871CB40DC500C806FE /* InterimSpace.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB84E1CB4115200C806FE /* InterimSpace.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7871CB40DC500C806FE /* InterimSpace.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB84F1CB4115200C806FE /* MaterialDepth.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7781CB40DC500C806FE /* MaterialDepth.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB84F1CB4115200C806FE /* Depth.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7781CB40DC500C806FE /* Depth.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8501CB4115200C806FE /* Insets.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB77A1CB40DC500C806FE /* Insets.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8501CB4115200C806FE /* Insets.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB77A1CB40DC500C806FE /* Insets.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8511CB4115200C806FE /* MaterialGravity.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB77C1CB40DC500C806FE /* MaterialGravity.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8511CB4115200C806FE /* MaterialGravity.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB77C1CB40DC500C806FE /* MaterialGravity.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8521CB4115200C806FE /* MaterialRadius.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7851CB40DC500C806FE /* MaterialRadius.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8521CB4115200C806FE /* MaterialRadius.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7851CB40DC500C806FE /* MaterialRadius.swift */; settings = {ATTRIBUTES = (Public, ); }; };
...@@ -241,7 +241,7 @@ ...@@ -241,7 +241,7 @@
96BCB7751CB40DC500C806FE /* MaterialCollectionViewLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialCollectionViewLayout.swift; sourceTree = "<group>"; }; 96BCB7751CB40DC500C806FE /* MaterialCollectionViewLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialCollectionViewLayout.swift; sourceTree = "<group>"; };
96BCB7761CB40DC500C806FE /* Color.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Color.swift; sourceTree = "<group>"; }; 96BCB7761CB40DC500C806FE /* Color.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Color.swift; sourceTree = "<group>"; };
96BCB7771CB40DC500C806FE /* MaterialDataSourceItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialDataSourceItem.swift; sourceTree = "<group>"; }; 96BCB7771CB40DC500C806FE /* MaterialDataSourceItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialDataSourceItem.swift; sourceTree = "<group>"; };
96BCB7781CB40DC500C806FE /* MaterialDepth.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialDepth.swift; sourceTree = "<group>"; }; 96BCB7781CB40DC500C806FE /* Depth.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Depth.swift; sourceTree = "<group>"; };
96BCB7791CB40DC500C806FE /* Device.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Device.swift; sourceTree = "<group>"; }; 96BCB7791CB40DC500C806FE /* Device.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Device.swift; sourceTree = "<group>"; };
96BCB77A1CB40DC500C806FE /* Insets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Insets.swift; sourceTree = "<group>"; }; 96BCB77A1CB40DC500C806FE /* Insets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Insets.swift; sourceTree = "<group>"; };
96BCB77B1CB40DC500C806FE /* Font.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Font.swift; sourceTree = "<group>"; }; 96BCB77B1CB40DC500C806FE /* Font.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Font.swift; sourceTree = "<group>"; };
...@@ -533,7 +533,7 @@ ...@@ -533,7 +533,7 @@
children = ( children = (
96BCB76F1CB40DC500C806FE /* MaterialBorder.swift */, 96BCB76F1CB40DC500C806FE /* MaterialBorder.swift */,
96BCB7871CB40DC500C806FE /* InterimSpace.swift */, 96BCB7871CB40DC500C806FE /* InterimSpace.swift */,
96BCB7781CB40DC500C806FE /* MaterialDepth.swift */, 96BCB7781CB40DC500C806FE /* Depth.swift */,
96BCB77A1CB40DC500C806FE /* Insets.swift */, 96BCB77A1CB40DC500C806FE /* Insets.swift */,
96BCB77C1CB40DC500C806FE /* MaterialGravity.swift */, 96BCB77C1CB40DC500C806FE /* MaterialGravity.swift */,
96BCB7851CB40DC500C806FE /* MaterialRadius.swift */, 96BCB7851CB40DC500C806FE /* MaterialRadius.swift */,
...@@ -721,7 +721,7 @@ ...@@ -721,7 +721,7 @@
96BCB84C1CB4115200C806FE /* TextView.swift in Headers */, 96BCB84C1CB4115200C806FE /* TextView.swift in Headers */,
96BCB84D1CB4115200C806FE /* MaterialBorder.swift in Headers */, 96BCB84D1CB4115200C806FE /* MaterialBorder.swift in Headers */,
96BCB84E1CB4115200C806FE /* InterimSpace.swift in Headers */, 96BCB84E1CB4115200C806FE /* InterimSpace.swift in Headers */,
96BCB84F1CB4115200C806FE /* MaterialDepth.swift in Headers */, 96BCB84F1CB4115200C806FE /* Depth.swift in Headers */,
96BCB8501CB4115200C806FE /* Insets.swift in Headers */, 96BCB8501CB4115200C806FE /* Insets.swift in Headers */,
96BCB8511CB4115200C806FE /* MaterialGravity.swift in Headers */, 96BCB8511CB4115200C806FE /* MaterialGravity.swift in Headers */,
96BCB8521CB4115200C806FE /* MaterialRadius.swift in Headers */, 96BCB8521CB4115200C806FE /* MaterialRadius.swift in Headers */,
...@@ -920,7 +920,7 @@ ...@@ -920,7 +920,7 @@
96BCB7CF1CB40DC500C806FE /* MaterialShape.swift in Sources */, 96BCB7CF1CB40DC500C806FE /* MaterialShape.swift in Sources */,
96BCB7DF1CB40DC500C806FE /* SearchBarController.swift in Sources */, 96BCB7DF1CB40DC500C806FE /* SearchBarController.swift in Sources */,
96BCB7D31CB40DC500C806FE /* MaterialTextLayer.swift in Sources */, 96BCB7D31CB40DC500C806FE /* MaterialTextLayer.swift in Sources */,
96BCB7C11CB40DC500C806FE /* MaterialDepth.swift in Sources */, 96BCB7C11CB40DC500C806FE /* Depth.swift in Sources */,
96BCB7D61CB40DC500C806FE /* Menu.swift in Sources */, 96BCB7D61CB40DC500C806FE /* Menu.swift in Sources */,
96BCB7E61CB40DC500C806FE /* TextStorage.swift in Sources */, 96BCB7E61CB40DC500C806FE /* TextStorage.swift in Sources */,
96BCB7B21CB40DC500C806FE /* Material+UIImage+Network.swift in Sources */, 96BCB7B21CB40DC500C806FE /* Material+UIImage+Network.swift in Sources */,
...@@ -1129,6 +1129,7 @@ ...@@ -1129,6 +1129,7 @@
9638324D1B88DFD80015F710 /* Debug */ = { 9638324D1B88DFD80015F710 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_ANALYZER_OBJC_UNUSED_IVARS = YES;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
...@@ -1137,6 +1138,7 @@ ...@@ -1137,6 +1138,7 @@
DYLIB_CURRENT_VERSION = 1; DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = ""; FRAMEWORK_SEARCH_PATHS = "";
GCC_WARN_UNUSED_VALUE = YES;
INFOPLIST_FILE = Sources/Info.plist; INFOPLIST_FILE = Sources/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
...@@ -1151,6 +1153,7 @@ ...@@ -1151,6 +1153,7 @@
9638324E1B88DFD80015F710 /* Release */ = { 9638324E1B88DFD80015F710 /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_ANALYZER_OBJC_UNUSED_IVARS = YES;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
...@@ -1159,6 +1162,7 @@ ...@@ -1159,6 +1162,7 @@
DYLIB_CURRENT_VERSION = 1; DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath"; DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = ""; FRAMEWORK_SEARCH_PATHS = "";
GCC_WARN_UNUSED_VALUE = YES;
INFOPLIST_FILE = Sources/Info.plist; INFOPLIST_FILE = Sources/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
......
...@@ -67,6 +67,6 @@ public class BarView : ControlView { ...@@ -67,6 +67,6 @@ public class BarView : ControlView {
*/ */
public override func prepareView() { public override func prepareView() {
super.prepareView() super.prepareView()
depth = .Depth1 depth = .depth1
} }
} }
...@@ -145,7 +145,7 @@ public class BottomNavigationController : UITabBarController, UITabBarController ...@@ -145,7 +145,7 @@ public class BottomNavigationController : UITabBarController, UITabBarController
/// Prepares the tabBar. /// Prepares the tabBar.
private func prepareTabBar() { private func prepareTabBar() {
tabBar.depth = .Depth1 tabBar.depth = .depth1
let image: UIImage? = UIImage.imageWithColor(Color.clear, size: CGSizeMake(1, 1)) let image: UIImage? = UIImage.imageWithColor(Color.clear, size: CGSizeMake(1, 1))
tabBar.shadowImage = image tabBar.shadowImage = image
tabBar.backgroundImage = image tabBar.backgroundImage = image
......
...@@ -233,8 +233,7 @@ public class BottomTabBar : UITabBar { ...@@ -233,8 +233,7 @@ public class BottomTabBar : UITabBar {
super.didMoveToSuperview() super.didMoveToSuperview()
if autoLayoutToSuperview { if autoLayoutToSuperview {
if let v: UIView = superview { if let v: UIView = superview {
v.layout(self).bottom() v.layout(self).bottom().horizontally()
v.layout(self).horizontally()
} }
} }
} }
...@@ -247,7 +246,7 @@ public class BottomTabBar : UITabBar { ...@@ -247,7 +246,7 @@ public class BottomTabBar : UITabBar {
when subclassing. when subclassing.
*/ */
public func prepareView() { public func prepareView() {
depth = .Depth1 depth = .depth1
contentScaleFactor = Device.scale contentScaleFactor = Device.scale
backgroundColor = Color.white backgroundColor = Color.white
let image: UIImage? = UIImage.imageWithColor(Color.clear, size: CGSizeMake(1, 1)) let image: UIImage? = UIImage.imageWithColor(Color.clear, size: CGSizeMake(1, 1))
...@@ -265,9 +264,9 @@ public class MaterialAssociatedObjectTabBar { ...@@ -265,9 +264,9 @@ public class MaterialAssociatedObjectTabBar {
for the backing layer. This is the preferred method of setting depth for the backing layer. This is the preferred method of setting depth
in order to maintain consitency across UI objects. in order to maintain consitency across UI objects.
*/ */
public var depth: MaterialDepth public var depthPreset
public init(depth: MaterialDepth) { public init(depthPreset) {
self.depth = depth self.depth = depth
} }
} }
...@@ -276,12 +275,12 @@ public extension UITabBar { ...@@ -276,12 +275,12 @@ public extension UITabBar {
/// TabBarItem reference. /// TabBarItem reference.
public internal(set) var item: MaterialAssociatedObjectTabBar { public internal(set) var item: MaterialAssociatedObjectTabBar {
get { get {
return AssociatedObject(self, key: &MaterialAssociatedObjectTabBarKey) { return AssociatedObject(base: self, key: &MaterialAssociatedObjectTabBarKey) {
return MaterialAssociatedObjectTabBar(depth: .None) return MaterialAssociatedObjectTabBar(depth: .none)
} }
} }
set(value) { set(value) {
AssociateObject(self, key: &MaterialAssociatedObjectTabBarKey, value: value) AssociateObject(base: self, key: &MaterialAssociatedObjectTabBarKey, value: value)
} }
} }
...@@ -290,12 +289,12 @@ public extension UITabBar { ...@@ -290,12 +289,12 @@ public extension UITabBar {
for the backing layer. This is the preferred method of setting depth for the backing layer. This is the preferred method of setting depth
in order to maintain consitency across UI objects. in order to maintain consitency across UI objects.
*/ */
public var depth: MaterialDepth { public var depthPreset {
get { get {
return item.depth return item.depth
} }
set(value) { set(value) {
let v: MaterialDepthType = MaterialDepthToValue(value) let v = DepthPresetToValue(preset: value)
layer.shadowOffset = v.offset layer.shadowOffset = v.offset
layer.shadowOpacity = v.opacity layer.shadowOpacity = v.opacity
layer.shadowRadius = v.radius layer.shadowRadius = v.radius
......
...@@ -201,15 +201,23 @@ public class Button: UIButton { ...@@ -201,15 +201,23 @@ public class Button: UIButton {
for the backing layer. This is the preferred method of setting depth for the backing layer. This is the preferred method of setting depth
in order to maintain consitency across UI objects. in order to maintain consitency across UI objects.
*/ */
public var depth: MaterialDepth = .None { public var depthPreset = .none {
didSet { didSet {
let value: MaterialDepthType = MaterialDepthToValue(depth: depth) let v = DepthPresetToValue(preset: depthPreset)
shadowOffset = value.offset shadowOffset = v.offset
shadowOpacity = value.opacity shadowOpacity = v.opacity
shadowRadius = value.radius shadowRadius = v.radius
layoutShadowPath() layoutShadowPath()
} }
} }
public var depth = Depth.zero {
didSet {
shadowOffset = depth.offset
shadowOpacity = depth.opacity
shadowRadius = depth.radius
}
}
/** /**
A property that sets the cornerRadius of the backing layer. If the shape A property that sets the cornerRadius of the backing layer. If the shape
...@@ -304,9 +312,9 @@ public class Button: UIButton { ...@@ -304,9 +312,9 @@ public class Button: UIButton {
} }
/// A preset property for updated contentEdgeInsets. /// A preset property for updated contentEdgeInsets.
public var contentEdgeInsetsPreset: MaterialEdgeInset { public var contentEdgeInsetsPreset: InsetsPreset {
didSet { didSet {
let value: UIEdgeInsets = MaterialEdgeInsetToValue(inset: contentEdgeInsetsPreset) let value: Insets = InsetsPresetToValue(preset: contentEdgeInsetsPreset)
contentEdgeInsets = UIEdgeInsetsMake(value.top, value.left, value.bottom, value.right) contentEdgeInsets = UIEdgeInsetsMake(value.top, value.left, value.bottom, value.right)
} }
} }
...@@ -316,7 +324,7 @@ public class Button: UIButton { ...@@ -316,7 +324,7 @@ public class Button: UIButton {
- Parameter aDecoder: A NSCoder instance. - Parameter aDecoder: A NSCoder instance.
*/ */
public required init?(coder aDecoder: NSCoder) { public required init?(coder aDecoder: NSCoder) {
contentEdgeInsetsPreset = .None contentEdgeInsetsPreset = .none
super.init(coder: aDecoder) super.init(coder: aDecoder)
prepareView() prepareView()
} }
......
...@@ -202,15 +202,15 @@ public class CaptureView : View, UIGestureRecognizerDelegate { ...@@ -202,15 +202,15 @@ public class CaptureView : View, UIGestureRecognizerDelegate {
} }
} }
/// MaterialEdgeInset preset value for content. /// Insets preset value for content.
public var contentInsetPreset: MaterialEdgeInset = .None { public var contentInsetPreset: InsetsPreset = .none {
didSet { didSet {
contentInset = MaterialEdgeInsetToValue(inset: contentInsetPreset) contentInset = InsetsPresetToValue(preset: contentInsetPreset)
} }
} }
/// Content insert value. /// Content insert value.
public var contentInset: UIEdgeInsets = MaterialEdgeInsetToValue(inset: .Square4) { public var contentInset: Insets = InsetsPresetToValue(preset: .square4) {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -435,7 +435,7 @@ public class CaptureView : View, UIGestureRecognizerDelegate { ...@@ -435,7 +435,7 @@ public class CaptureView : View, UIGestureRecognizerDelegate {
internal func handleTapToFocusGesture(recognizer: UITapGestureRecognizer) { internal func handleTapToFocusGesture(recognizer: UITapGestureRecognizer) {
if enableTapToFocus && captureSession.isFocusPointOfInterestSupported { if enableTapToFocus && captureSession.isFocusPointOfInterestSupported {
let point: CGPoint = recognizer.location(in: self) let point: CGPoint = recognizer.location(in: self)
captureSession.focus(point: previewView.captureDevicePointOfInterestForPoint(point: point)) captureSession.focus(at: previewView.captureDevicePointOfInterestForPoint(point: point))
animateTapLayer(layer: focusLayer!, point: point) animateTapLayer(layer: focusLayer!, point: point)
(delegate as? CaptureViewDelegate)?.captureViewDidTapToFocusAtPoint?(captureView: self, point: point) (delegate as? CaptureViewDelegate)?.captureViewDidTapToFocusAtPoint?(captureView: self, point: point)
} }
...@@ -449,7 +449,7 @@ public class CaptureView : View, UIGestureRecognizerDelegate { ...@@ -449,7 +449,7 @@ public class CaptureView : View, UIGestureRecognizerDelegate {
internal func handleTapToExposeGesture(recognizer: UITapGestureRecognizer) { internal func handleTapToExposeGesture(recognizer: UITapGestureRecognizer) {
if enableTapToExpose && captureSession.isExposurePointOfInterestSupported { if enableTapToExpose && captureSession.isExposurePointOfInterestSupported {
let point: CGPoint = recognizer.location(in: self) let point: CGPoint = recognizer.location(in: self)
captureSession.expose(point: previewView.captureDevicePointOfInterestForPoint(point: point)) captureSession.expose(at: previewView.captureDevicePointOfInterestForPoint(point: point))
animateTapLayer(layer: exposureLayer!, point: point) animateTapLayer(layer: exposureLayer!, point: point)
(delegate as? CaptureViewDelegate)?.captureViewDidTapToExposeAtPoint?(captureView: self, point: point) (delegate as? CaptureViewDelegate)?.captureViewDidTapToExposeAtPoint?(captureView: self, point: point)
} }
......
...@@ -41,14 +41,14 @@ public class CardView : PulseView { ...@@ -41,14 +41,14 @@ public class CardView : PulseView {
*/ */
@IBInspectable public var dividerColor: UIColor? { @IBInspectable public var dividerColor: UIColor? {
didSet { didSet {
dividerLayer?.backgroundColor = dividerColor?.CGColor dividerLayer?.backgroundColor = dividerColor?.cgColor
} }
} }
/** /**
:name: divider :name: divider
*/ */
@IBInspectable public var divider: Bool = true { @IBInspectable public var divider = true {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -57,16 +57,16 @@ public class CardView : PulseView { ...@@ -57,16 +57,16 @@ public class CardView : PulseView {
/** /**
:name: dividerInsets :name: dividerInsets
*/ */
public var dividerInsetPreset: MaterialEdgeInset = .None { public var dividerInsetPreset: InsetsPreset = .none {
didSet { didSet {
dividerInset = MaterialEdgeInsetToValue(dividerInsetPreset) dividerInset = InsetsPresetToValue(preset: dividerInsetPreset)
} }
} }
/** /**
:name: dividerInset :name: dividerInset
*/ */
@IBInspectable public var dividerInset: UIEdgeInsets = UIEdgeInsets(top: 8, left: 0, bottom: 8, right: 0) { @IBInspectable public var dividerInset = Insets(top: 8, left: 0, bottom: 8, right: 0) {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -75,16 +75,16 @@ public class CardView : PulseView { ...@@ -75,16 +75,16 @@ public class CardView : PulseView {
/** /**
:name: contentInsets :name: contentInsets
*/ */
public var contentInsetPreset: MaterialEdgeInset = .Square2 { public var contentInsetPreset: InsetsPreset = .square2 {
didSet { didSet {
contentInset = MaterialEdgeInsetToValue(contentInsetPreset) contentInset = InsetsPresetToValue(preset: contentInsetPreset)
} }
} }
/** /**
:name: contentInset :name: contentInset
*/ */
@IBInspectable public var contentInset: UIEdgeInsets = MaterialEdgeInsetToValue(.Square2) { @IBInspectable public var contentInset = InsetsPresetToValue(preset: .square2) {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -93,16 +93,16 @@ public class CardView : PulseView { ...@@ -93,16 +93,16 @@ public class CardView : PulseView {
/** /**
:name: titleLabelInsets :name: titleLabelInsets
*/ */
public var titleLabelInsetPreset: MaterialEdgeInset = .Square2 { public var titleLabelInsetPreset: InsetsPreset = .square2 {
didSet { didSet {
titleLabelInset = MaterialEdgeInsetToValue(titleLabelInsetPreset) titleLabelInset = InsetsPresetToValue(preset: titleLabelInsetPreset)
} }
} }
/** /**
:name: titleLabelInset :name: titleLabelInset
*/ */
@IBInspectable public var titleLabelInset: UIEdgeInsets = MaterialEdgeInsetToValue(.Square2) { @IBInspectable public var titleLabelInset = InsetsPresetToValue(preset: .square2) {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -120,16 +120,16 @@ public class CardView : PulseView { ...@@ -120,16 +120,16 @@ public class CardView : PulseView {
/** /**
:name: contentViewInsets :name: contentViewInsets
*/ */
public var contentViewInsetPreset: MaterialEdgeInset = .Square2 { public var contentViewInsetPreset: InsetsPreset = .square2 {
didSet { didSet {
contentViewInset = MaterialEdgeInsetToValue(contentViewInsetPreset) contentViewInset = InsetsPresetToValue(preset: contentViewInsetPreset)
} }
} }
/** /**
:name: contentViewInset :name: contentViewInset
*/ */
@IBInspectable public var contentViewInset: UIEdgeInsets = MaterialEdgeInsetToValue(.Square2) { @IBInspectable public var contentViewInset = InsetsPresetToValue(preset: .square2) {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -147,16 +147,16 @@ public class CardView : PulseView { ...@@ -147,16 +147,16 @@ public class CardView : PulseView {
/** /**
:name: leftButtonsInsets :name: leftButtonsInsets
*/ */
public var leftButtonsInsetPreset: MaterialEdgeInset = .None { public var leftButtonsInsetPreset: InsetsPreset = .none {
didSet { didSet {
leftButtonsInset = MaterialEdgeInsetToValue(leftButtonsInsetPreset) leftButtonsInset = InsetsPresetToValue(preset: leftButtonsInsetPreset)
} }
} }
/** /**
:name: leftButtonsInset :name: leftButtonsInset
*/ */
@IBInspectable public var leftButtonsInset: UIEdgeInsets = MaterialEdgeInsetToValue(.None) { @IBInspectable public var leftButtonsInset = Insets.zero {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -174,16 +174,16 @@ public class CardView : PulseView { ...@@ -174,16 +174,16 @@ public class CardView : PulseView {
/** /**
:name: rightButtonsInsets :name: rightButtonsInsets
*/ */
public var rightButtonsInsetPreset: MaterialEdgeInset = .None { public var rightButtonsInsetPreset: InsetsPreset = .none {
didSet { didSet {
rightButtonsInset = MaterialEdgeInsetToValue(rightButtonsInsetPreset) rightButtonsInset = InsetsPresetToValue(preset: rightButtonsInsetPreset)
} }
} }
/** /**
:name: rightButtonsInset :name: rightButtonsInset
*/ */
@IBInspectable public var rightButtonsInset: UIEdgeInsets = MaterialEdgeInsetToValue(.None) { @IBInspectable public var rightButtonsInset = Insets.zero {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -224,14 +224,14 @@ public class CardView : PulseView { ...@@ -224,14 +224,14 @@ public class CardView : PulseView {
*/ */
public convenience init?(image: UIImage? = nil, titleLabel: UILabel? = nil, contentView: UIView? = nil, leftButtons: Array<UIButton>? = nil, rightButtons: Array<UIButton>? = nil) { public convenience init?(image: UIImage? = nil, titleLabel: UILabel? = nil, contentView: UIView? = nil, leftButtons: Array<UIButton>? = nil, rightButtons: Array<UIButton>? = nil) {
self.init(frame: CGRect.zero) self.init(frame: CGRect.zero)
prepareProperties(image, titleLabel: titleLabel, contentView: contentView, leftButtons: leftButtons, rightButtons: rightButtons) prepareProperties(image: image, titleLabel: titleLabel, contentView: contentView, leftButtons: leftButtons, rightButtons: rightButtons)
} }
/** /**
:name: layoutSublayersOfLayer :name: layoutSublayersOfLayer
*/ */
public override func layoutSublayersOfLayer(layer: CALayer) { public override func layoutSublayers(of layer: CALayer) {
super.layoutSublayersOfLayer(layer) super.layoutSublayers(of: layer)
if self.layer == layer { if self.layer == layer {
if divider { if divider {
var y: CGFloat = contentInset.bottom + dividerInset.bottom var y: CGFloat = contentInset.bottom + dividerInset.bottom
...@@ -241,7 +241,7 @@ public class CardView : PulseView { ...@@ -241,7 +241,7 @@ public class CardView : PulseView {
y += rightButtonsInset.top + rightButtonsInset.bottom + rightButtons![0].frame.height y += rightButtonsInset.top + rightButtonsInset.bottom + rightButtons![0].frame.height
} }
if 0 < y { if 0 < y {
prepareDivider(bounds.height - y - 0.5, width: bounds.width) prepareDivider(y: bounds.height - y - 0.5, width: bounds.width)
} }
} else { } else {
dividerLayer?.removeFromSuperlayer() dividerLayer?.removeFromSuperlayer()
...@@ -319,7 +319,7 @@ public class CardView : PulseView { ...@@ -319,7 +319,7 @@ public class CardView : PulseView {
i += 1 i += 1
} }
addConstraints(Layout.constraint(h, options: [], metrics: ["left" : contentInset.left + leftButtonsInset.left, "left_right" : leftButtonsInset.left + leftButtonsInset.right], views: d)) addConstraints(Layout.constraint(format: h, options: [], metrics: ["left" : contentInset.left + leftButtonsInset.left, "left_right" : leftButtonsInset.left + leftButtonsInset.right], views: d))
} }
} }
...@@ -348,7 +348,7 @@ public class CardView : PulseView { ...@@ -348,7 +348,7 @@ public class CardView : PulseView {
i -= 1 i -= 1
} }
addConstraints(Layout.constraint(h + "|", options: [], metrics: ["right" : contentInset.right + rightButtonsInset.right, "right_left" : rightButtonsInset.right + rightButtonsInset.left], views: d)) addConstraints(Layout.constraint(format: h + "|", options: [], metrics: ["right" : contentInset.right + rightButtonsInset.right, "right_left" : rightButtonsInset.right + rightButtonsInset.left], views: d))
} }
} }
...@@ -382,7 +382,7 @@ public class CardView : PulseView { ...@@ -382,7 +382,7 @@ public class CardView : PulseView {
if 0 < views.count { if 0 < views.count {
verticalFormat += "-(insetBottom)-|" verticalFormat += "-(insetBottom)-|"
addConstraints(Layout.constraint(verticalFormat, options: [], metrics: metrics, views: views)) addConstraints(Layout.constraint(format: verticalFormat, options: [], metrics: metrics, views: views))
} }
} }
...@@ -391,7 +391,7 @@ public class CardView : PulseView { ...@@ -391,7 +391,7 @@ public class CardView : PulseView {
*/ */
public override func prepareView() { public override func prepareView() {
super.prepareView() super.prepareView()
depth = .Depth1 depth = .depth1
dividerColor = Color.grey.lighten3 dividerColor = Color.grey.lighten3
cornerRadiusPreset = .Radius1 cornerRadiusPreset = .Radius1
} }
...@@ -405,8 +405,8 @@ public class CardView : PulseView { ...@@ -405,8 +405,8 @@ public class CardView : PulseView {
dividerLayer!.zPosition = 0 dividerLayer!.zPosition = 0
layer.addSublayer(dividerLayer!) layer.addSublayer(dividerLayer!)
} }
dividerLayer?.backgroundColor = dividerColor?.CGColor dividerLayer?.backgroundColor = dividerColor?.cgColor
dividerLayer?.frame = CGRectMake(dividerInset.left, y, width - dividerInset.left - dividerInset.right, 1) dividerLayer?.frame = CGRect(x: dividerInset.left, y: y, width: width - dividerInset.left - dividerInset.right, height: 1)
} }
/** /**
......
...@@ -37,7 +37,7 @@ public class ControlView : View { ...@@ -37,7 +37,7 @@ public class ControlView : View {
} }
/// A preset wrapper around contentInset. /// A preset wrapper around contentInset.
public var contentInsetPreset: MaterialEdgeInset { public var contentInsetPreset: InsetsPreset {
get { get {
return grid.contentInsetPreset return grid.contentInsetPreset
} }
...@@ -47,7 +47,7 @@ public class ControlView : View { ...@@ -47,7 +47,7 @@ public class ControlView : View {
} }
/// A wrapper around grid.contentInset. /// A wrapper around grid.contentInset.
@IBInspectable public var contentInset: UIEdgeInsets { @IBInspectable public var contentInset: Insets {
get { get {
return grid.contentInset return grid.contentInset
} }
...@@ -57,14 +57,14 @@ public class ControlView : View { ...@@ -57,14 +57,14 @@ public class ControlView : View {
} }
/// A preset wrapper around interimSpace. /// A preset wrapper around interimSpace.
public var interimSpacePreset: InterimSpace = .none { public var interimSpacePreset: InterimSpacePreset = .none {
didSet { didSet {
interimSpace = InterimSpaceToValue(interimSpacePreset) interimSpace = InterimSpacePresetToValue(preset: interimSpacePreset)
} }
} }
/// A wrapper around grid.interimSpace. /// A wrapper around grid.interimSpace.
@IBInspectable public var interimSpace: CGFloat { @IBInspectable public var interimSpace: InterimSpace {
get { get {
return grid.interimSpace return grid.interimSpace
} }
......
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
public enum DepthPreset {
case none
case depth1
case depth2
case depth3
case depth4
case depth5
}
public struct Depth {
/// Offset.
public var offset: UIOffset
/// Opacity.
public var opacity: Float
/// Radius.
public var radius: CGFloat
/**
Initializer.
- Parameter offset: UIOffset.
- Parameter opacity: Float.
- Parameter radius: CGFloat.
*/
public init(offset: UIOffset = UIOffset.zero, opacity: Float = 0, radius: CGFloat = 0) {
self.offset = offset
self.opacity = opacity
self.radius = radius
}
/**
Static constructor for Depth with values of 0.
- Returns: A Depth struct with values of 0.
*/
static var zero: Depth {
return Depth()
}
}
/// Converts the DepthPreset enum to a Depth value.
public func DepthPresetToValue(preset: DepthPreset) -> Depth {
switch preset {
case .none:
return Depth.zero
case .depth1:
return Depth(offset: UIOffset(horizontal: 0, vertical: 1), opacity: 0.3, radius: 1)
case .depth2:
return Depth(offset: UIOffset(horizontal: 0, vertical: 2), opacity: 0.3, radius: 2)
case .depth3:
return Depth(offset: UIOffset(horizontal: 0, vertical: 3), opacity: 0.3, radius: 3)
case .depth4:
return Depth(offset: UIOffset(horizontal: 0, vertical: 4), opacity: 0.3, radius: 4)
case .depth5:
return Depth(offset: UIOffset(horizontal: 0, vertical: 5), opacity: 0.3, radius: 5)
}
}
...@@ -40,11 +40,11 @@ public class FabButton: Button { ...@@ -40,11 +40,11 @@ public class FabButton: Button {
*/ */
public override func prepareView() { public override func prepareView() {
super.prepareView() super.prepareView()
depth = .Depth1 depth = .depth1
shape = .Circle shape = .Circle
pulseAnimation = .CenterWithBacking pulseAnimation = .CenterWithBacking
pulseColor = Color.white pulseColor = Color.white
tintColor = Color.white tintColor = Color.white
backgroundColor = Color.red.base backgroundColor = Color.red.base
} }
} }
\ No newline at end of file
...@@ -131,12 +131,12 @@ public class Grid { ...@@ -131,12 +131,12 @@ public class Grid {
/// Preset inset value for grid. /// Preset inset value for grid.
public var layoutInsetsPreset: InsetsPreset = .none { public var layoutInsetsPreset: InsetsPreset = .none {
didSet { didSet {
layoutInsets = InsetsPresetToValue(insets: contentInsetsPreset) layoutInsets = InsetsPresetToValue(preset: contentInsetsPreset)
} }
} }
/// Insets value for grid. /// Insets value for grid.
public var layoutInsets: Insets = InsetsPresetToValue(insets: .none) { public var layoutInsets: Insets = InsetsPresetToValue(preset: .none) {
didSet { didSet {
reload() reload()
} }
...@@ -145,26 +145,26 @@ public class Grid { ...@@ -145,26 +145,26 @@ public class Grid {
/// Preset inset value for grid. /// Preset inset value for grid.
public var contentInsetsPreset: InsetsPreset = .none { public var contentInsetsPreset: InsetsPreset = .none {
didSet { didSet {
contentInsets = InsetsPresetToValue(insets: contentInsetsPreset) contentInsets = InsetsPresetToValue(preset: contentInsetsPreset)
} }
} }
/// Insets value for grid. /// Insets value for grid.
public var contentInsets: Insets = InsetsPresetToValue(insets: .none) { public var contentInsets: Insets = InsetsPresetToValue(preset: .none) {
didSet { didSet {
reload() reload()
} }
} }
/// A preset wrapper for interim space. /// A preset wrapper for interim space.
public var interimSpacePreset: InterimSpace = .none { public var interimSpacePreset: InterimSpacePreset = .none {
didSet { didSet {
interimSpace = InterimSpaceToValue(interimSpace: interimSpacePreset) interimSpace = InterimSpacePresetToValue(preset: interimSpacePreset)
} }
} }
/// The space between grid rows and columnss. /// The space between grid rows and columnss.
public var interimSpace: CGFloat { public var interimSpace: InterimSpace {
didSet { didSet {
reload() reload()
} }
...@@ -181,9 +181,9 @@ public class Grid { ...@@ -181,9 +181,9 @@ public class Grid {
Initializer. Initializer.
- Parameter rows: The number of rows, vertical axis the grid will use. - Parameter rows: The number of rows, vertical axis the grid will use.
- Parameter columns: The number of columns, horizontal axis the grid will use. - Parameter columns: The number of columns, horizontal axis the grid will use.
- Parameter interimSpace: The interimSpace between rows or columns. - Parameter interimSpace: The interim space between rows or columns.
*/ */
public init(context: UIView?, rows: Int = 12, columns: Int = 12, interimSpace: CGFloat = 0) { public init(context: UIView?, rows: Int = 12, columns: Int = 12, interimSpace: InterimSpace = 0) {
self.context = context self.context = context
self.rows = rows self.rows = rows
self.columns = columns self.columns = columns
......
...@@ -57,16 +57,16 @@ public class ImageCardView : PulseView { ...@@ -57,16 +57,16 @@ public class ImageCardView : PulseView {
/** /**
:name: dividerInsets :name: dividerInsets
*/ */
public var dividerInsetPreset: MaterialEdgeInset = .None { public var dividerInsetPreset: InsetsPreset = .none {
didSet { didSet {
dividerInset = MaterialEdgeInsetToValue(dividerInsetPreset) dividerInset = InsetsPresetToValue(preset: dividerInsetPreset)
} }
} }
/** /**
:name: dividerInset :name: dividerInset
*/ */
@IBInspectable public var dividerInset: UIEdgeInsets = UIEdgeInsets(top: 8, left: 0, bottom: 8, right: 0) { @IBInspectable public var dividerInset = Insets(top: 8, left: 0, bottom: 8, right: 0) {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -168,16 +168,16 @@ public class ImageCardView : PulseView { ...@@ -168,16 +168,16 @@ public class ImageCardView : PulseView {
/** /**
:name: contentInsets :name: contentInsets
*/ */
public var contentInsetPreset: MaterialEdgeInset = .Square2 { public var contentInsetPreset: InsetsPreset = .square2 {
didSet { didSet {
contentInset = MaterialEdgeInsetToValue(contentInsetPreset) contentInset = InsetsPresetToValue(preset: contentInsetPreset)
} }
} }
/** /**
:name: contentInset :name: contentInset
*/ */
@IBInspectable public var contentInset: UIEdgeInsets = MaterialEdgeInsetToValue(.Square2) { @IBInspectable public var contentInset = InsetsPresetToValue(preset: .square2) {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -186,16 +186,16 @@ public class ImageCardView : PulseView { ...@@ -186,16 +186,16 @@ public class ImageCardView : PulseView {
/** /**
:name: titleLabelInsets :name: titleLabelInsets
*/ */
public var titleLabelInsetPreset: MaterialEdgeInset = .Square2 { public var titleLabelInsetPreset: InsetsPreset = .square2 {
didSet { didSet {
titleLabelInset = MaterialEdgeInsetToValue(titleLabelInsetPreset) titleLabelInset = InsetsPresetToValue(preset: titleLabelInsetPreset)
} }
} }
/** /**
:name: titleLabelInset :name: titleLabelInset
*/ */
@IBInspectable public var titleLabelInset: UIEdgeInsets = MaterialEdgeInsetToValue(.Square2) { @IBInspectable public var titleLabelInset = InsetsPresetToValue(preset: .square2) {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -213,16 +213,16 @@ public class ImageCardView : PulseView { ...@@ -213,16 +213,16 @@ public class ImageCardView : PulseView {
/** /**
:name: contentViewInsets :name: contentViewInsets
*/ */
public var contentViewInsetPreset: MaterialEdgeInset = .Square2 { public var contentViewInsetPreset: InsetsPreset = .square2 {
didSet { didSet {
contentViewInset = MaterialEdgeInsetToValue(contentViewInsetPreset) contentViewInset = InsetsPresetToValue(preset: contentViewInsetPreset)
} }
} }
/** /**
:name: contentViewInset :name: contentViewInset
*/ */
@IBInspectable public var contentViewInset: UIEdgeInsets = MaterialEdgeInsetToValue(.Square2) { @IBInspectable public var contentViewInset = InsetsPresetToValue(preset: .square2) {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -240,16 +240,16 @@ public class ImageCardView : PulseView { ...@@ -240,16 +240,16 @@ public class ImageCardView : PulseView {
/** /**
:name: leftButtonsInsets :name: leftButtonsInsets
*/ */
public var leftButtonsInsetPreset: MaterialEdgeInset = .None { public var leftButtonsInsetPreset: InsetsPreset = .none {
didSet { didSet {
leftButtonsInset = MaterialEdgeInsetToValue(leftButtonsInsetPreset) leftButtonsInset = InsetsPresetToValue(preset: leftButtonsInsetPreset)
} }
} }
/** /**
:name: leftButtonsInset :name: leftButtonsInset
*/ */
@IBInspectable public var leftButtonsInset: UIEdgeInsets = MaterialEdgeInsetToValue(.None) { @IBInspectable public var leftButtonsInset = Insets.zero {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -267,16 +267,16 @@ public class ImageCardView : PulseView { ...@@ -267,16 +267,16 @@ public class ImageCardView : PulseView {
/** /**
:name: rightButtonsInsets :name: rightButtonsInsets
*/ */
public var rightButtonsInsetPreset: MaterialEdgeInset = .None { public var rightButtonsInsetPreset: InsetsPreset = .none {
didSet { didSet {
rightButtonsInset = MaterialEdgeInsetToValue(rightButtonsInsetPreset) rightButtonsInset = InsetsPresetToValue(preset: rightButtonsInsetPreset)
} }
} }
/** /**
:name: rightButtonsInset :name: rightButtonsInset
*/ */
@IBInspectable public var rightButtonsInset: UIEdgeInsets = MaterialEdgeInsetToValue(.None) { @IBInspectable public var rightButtonsInset = Insets.zero {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -317,14 +317,14 @@ public class ImageCardView : PulseView { ...@@ -317,14 +317,14 @@ public class ImageCardView : PulseView {
*/ */
public convenience init?(image: UIImage? = nil, titleLabel: UILabel? = nil, contentView: UIView? = nil, leftButtons: Array<UIButton>? = nil, rightButtons: Array<UIButton>? = nil) { public convenience init?(image: UIImage? = nil, titleLabel: UILabel? = nil, contentView: UIView? = nil, leftButtons: Array<UIButton>? = nil, rightButtons: Array<UIButton>? = nil) {
self.init(frame: CGRect.zero) self.init(frame: CGRect.zero)
prepareProperties(image, titleLabel: titleLabel, contentView: contentView, leftButtons: leftButtons, rightButtons: rightButtons) prepareProperties(image: image, titleLabel: titleLabel, contentView: contentView, leftButtons: leftButtons, rightButtons: rightButtons)
} }
/** /**
:name: layoutSublayersOfLayer :name: layoutSublayersOfLayer
*/ */
public override func layoutSublayersOfLayer(layer: CALayer) { public override func layoutSublayers(of layer: CALayer) {
super.layoutSublayersOfLayer(layer) super.layoutSublayers(of: layer)
if self.layer == layer { if self.layer == layer {
// image // image
imageLayer?.frame.size.width = bounds.width imageLayer?.frame.size.width = bounds.width
...@@ -338,7 +338,7 @@ public class ImageCardView : PulseView { ...@@ -338,7 +338,7 @@ public class ImageCardView : PulseView {
y += rightButtonsInset.top + rightButtonsInset.bottom + rightButtons![0].frame.height y += rightButtonsInset.top + rightButtonsInset.bottom + rightButtons![0].frame.height
} }
if 0 < y { if 0 < y {
prepareDivider(bounds.height - y - 0.5, width: bounds.width) prepareDivider(y: bounds.height - y - 0.5, width: bounds.width)
} }
} else { } else {
dividerLayer?.removeFromSuperlayer() dividerLayer?.removeFromSuperlayer()
...@@ -422,7 +422,7 @@ public class ImageCardView : PulseView { ...@@ -422,7 +422,7 @@ public class ImageCardView : PulseView {
i += 1 i += 1
} }
addConstraints(Layout.constraint(h, options: [], metrics: ["left" : contentInset.left + leftButtonsInset.left, "left_right" : leftButtonsInset.left + leftButtonsInset.right], views: d)) addConstraints(Layout.constraint(format: h, options: [], metrics: ["left" : contentInset.left + leftButtonsInset.left, "left_right" : leftButtonsInset.left + leftButtonsInset.right], views: d))
} }
} }
...@@ -451,7 +451,7 @@ public class ImageCardView : PulseView { ...@@ -451,7 +451,7 @@ public class ImageCardView : PulseView {
i -= 1 i -= 1
} }
addConstraints(Layout.constraint(h + "|", options: [], metrics: ["right" : contentInset.right + rightButtonsInset.right, "right_left" : rightButtonsInset.right + rightButtonsInset.left], views: d)) addConstraints(Layout.constraint(format: h + "|", options: [], metrics: ["right" : contentInset.right + rightButtonsInset.right, "right_left" : rightButtonsInset.right + rightButtonsInset.left], views: d))
} }
} }
...@@ -514,7 +514,7 @@ public class ImageCardView : PulseView { ...@@ -514,7 +514,7 @@ public class ImageCardView : PulseView {
metrics["insetBottom"] = contentInset.bottom + rightButtonsInset.bottom metrics["insetBottom"] = contentInset.bottom + rightButtonsInset.bottom
} else { } else {
if translatesAutoresizingMaskIntoConstraints { if translatesAutoresizingMaskIntoConstraints {
addConstraints(Layout.constraint("V:[view(height)]", options: [], metrics: ["height": imageLayer!.frame.height], views: ["view": self])) addConstraints(Layout.constraint(format: "V:[view(height)]", options: [], metrics: ["height": imageLayer!.frame.height], views: ["view": self]))
} else { } else {
height = imageLayer!.frame.height height = imageLayer!.frame.height
} }
...@@ -523,7 +523,7 @@ public class ImageCardView : PulseView { ...@@ -523,7 +523,7 @@ public class ImageCardView : PulseView {
if 0 < views.count { if 0 < views.count {
verticalFormat += "-(insetBottom)-|" verticalFormat += "-(insetBottom)-|"
addConstraints(Layout.constraint(verticalFormat, options: [], metrics: metrics, views: views)) addConstraints(Layout.constraint(format: verticalFormat, options: [], metrics: metrics, views: views))
} }
} }
...@@ -532,7 +532,7 @@ public class ImageCardView : PulseView { ...@@ -532,7 +532,7 @@ public class ImageCardView : PulseView {
*/ */
public override func prepareView() { public override func prepareView() {
super.prepareView() super.prepareView()
depth = .Depth1 depth = .depth1
dividerColor = Color.grey.lighten3 dividerColor = Color.grey.lighten3
cornerRadiusPreset = .Radius1 cornerRadiusPreset = .Radius1
} }
...@@ -558,8 +558,8 @@ public class ImageCardView : PulseView { ...@@ -558,8 +558,8 @@ public class ImageCardView : PulseView {
dividerLayer!.zPosition = 0 dividerLayer!.zPosition = 0
layer.addSublayer(dividerLayer!) layer.addSublayer(dividerLayer!)
} }
dividerLayer?.backgroundColor = dividerColor?.CGColor dividerLayer?.backgroundColor = dividerColor?.cgColor
dividerLayer?.frame = CGRectMake(dividerInset.left, y, width - dividerInset.left - dividerInset.right, 1) dividerLayer?.frame = CGRect(x: dividerInset.left, y: y, width: width - dividerInset.left - dividerInset.right, height: 1)
} }
/** /**
......
...@@ -97,8 +97,8 @@ public struct Insets { ...@@ -97,8 +97,8 @@ public struct Insets {
} }
/** /**
Static constructor for Insets with values of all 0. Static constructor for Insets with values of 0.
- Returns: An Insets struct with values of all 0. - Returns: An Insets struct with values of 0.
*/ */
static var zero: Insets { static var zero: Insets {
return Insets() return Insets()
...@@ -106,8 +106,8 @@ public struct Insets { ...@@ -106,8 +106,8 @@ public struct Insets {
} }
/// Converts the InsetsPreset to a Insets value. /// Converts the InsetsPreset to a Insets value.
public func InsetsPresetToValue(insets: InsetsPreset) -> Insets { public func InsetsPresetToValue(preset: InsetsPreset) -> Insets {
switch insets { switch preset {
case .none: case .none:
return Insets.zero return Insets.zero
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
import UIKit import UIKit
public enum InterimSpace { public enum InterimSpacePreset {
case none case none
case interimSpace1 case interimSpace1
case interimSpace2 case interimSpace2
...@@ -43,9 +43,11 @@ public enum InterimSpace { ...@@ -43,9 +43,11 @@ public enum InterimSpace {
case interimSpace9 case interimSpace9
} }
/// Converts the InterimSpace enum to a CGFloat value. public typealias InterimSpace = CGFloat
public func InterimSpaceToValue(interimSpace: InterimSpace) -> CGFloat {
switch interimSpace { /// Converts the InterimSpacePreset enum to an InterimSpace value.
public func InterimSpacePresetToValue(preset: InterimSpacePreset) -> InterimSpace {
switch preset {
case .none: case .none:
return 0 return 0
case .interimSpace1: case .interimSpace1:
......
...@@ -174,9 +174,9 @@ public class Layer: CAShapeLayer { ...@@ -174,9 +174,9 @@ public class Layer: CAShapeLayer {
for the backing layer. This is the preferred method of setting depth for the backing layer. This is the preferred method of setting depth
in order to maintain consitency across UI objects. in order to maintain consitency across UI objects.
*/ */
public var depth: MaterialDepth = .None { public var depthPreset = .none {
didSet { didSet {
let value: MaterialDepthType = MaterialDepthToValue(depth: depth) let value: Depth = DepthPresetToValue(preset: depth)
shadowOffset = value.offset shadowOffset = value.offset
shadowOpacity = value.opacity shadowOpacity = value.opacity
shadowRadius = value.radius shadowRadius = value.radius
......
...@@ -133,7 +133,7 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -133,7 +133,7 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
} }
/// A preset wrapper around contentInset. /// A preset wrapper around contentInset.
public var contentInsetPreset: MaterialEdgeInset { public var contentInsetPreset: Insets {
get { get {
return grid.contentInsetPreset return grid.contentInsetPreset
} }
...@@ -155,12 +155,12 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -155,12 +155,12 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
/// A preset wrapper around interimSpace. /// A preset wrapper around interimSpace.
public var interimSpacePreset: InterimSpace = .none { public var interimSpacePreset: InterimSpace = .none {
didSet { didSet {
interimSpace = InterimSpaceToValue(interimSpacePreset) interimSpace = InterimSpacePresetToValue(interimSpacePreset)
} }
} }
/// A wrapper around grid.interimSpace. /// A wrapper around grid.interimSpace.
@IBInspectable public var interimSpace: CGFloat { @IBInspectable public var interimSpace: InterimSpace {
get { get {
return grid.interimSpace return grid.interimSpace
} }
...@@ -308,9 +308,9 @@ public class MaterialCollectionReusableView : UICollectionReusableView { ...@@ -308,9 +308,9 @@ public class MaterialCollectionReusableView : UICollectionReusableView {
for the backing layer. This is the preferred method of setting depth for the backing layer. This is the preferred method of setting depth
in order to maintain consitency across UI objects. in order to maintain consitency across UI objects.
*/ */
public var depth: MaterialDepth { public var depthPreset {
didSet { didSet {
let value: MaterialDepthType = MaterialDepthToValue(depth) let value: Depth = DepthPresetToValue(preset)
shadowOffset = value.offset shadowOffset = value.offset
shadowOpacity = value.opacity shadowOpacity = value.opacity
shadowRadius = value.radius shadowRadius = value.radius
......
...@@ -73,7 +73,7 @@ public class MaterialCollectionView : UICollectionView { ...@@ -73,7 +73,7 @@ public class MaterialCollectionView : UICollectionView {
} }
/// A preset wrapper around contentInset. /// A preset wrapper around contentInset.
public var contentInsetPreset: MaterialEdgeInset { public var contentInsetPreset: Insets {
get { get {
return (collectionViewLayout as? MaterialCollectionViewLayout)!.contentInsetPreset return (collectionViewLayout as? MaterialCollectionViewLayout)!.contentInsetPreset
} }
...@@ -104,12 +104,12 @@ public class MaterialCollectionView : UICollectionView { ...@@ -104,12 +104,12 @@ public class MaterialCollectionView : UICollectionView {
/// A preset wrapper around interimSpace. /// A preset wrapper around interimSpace.
public var interimSpacePreset: InterimSpace = .none { public var interimSpacePreset: InterimSpace = .none {
didSet { didSet {
interimSpace = InterimSpaceToValue(interimSpacePreset) interimSpace = InterimSpacePresetToValue(interimSpacePreset)
} }
} }
/// Spacing between items. /// Spacing between items.
@IBInspectable public var interimSpace: CGFloat { @IBInspectable public var interimSpace: InterimSpace {
get { get {
return (collectionViewLayout as? MaterialCollectionViewLayout)!.interimSpace return (collectionViewLayout as? MaterialCollectionViewLayout)!.interimSpace
} }
......
...@@ -133,7 +133,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -133,7 +133,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
} }
/// A preset wrapper around contentInset. /// A preset wrapper around contentInset.
public var contentInsetPreset: MaterialEdgeInset { public var contentInsetPreset: Insets {
get { get {
return contentView.grid.contentInsetPreset return contentView.grid.contentInsetPreset
} }
...@@ -155,12 +155,12 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -155,12 +155,12 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
/// A preset wrapper around interimSpace. /// A preset wrapper around interimSpace.
public var interimSpacePreset: InterimSpace = .none { public var interimSpacePreset: InterimSpace = .none {
didSet { didSet {
interimSpace = InterimSpaceToValue(interimSpacePreset) interimSpace = InterimSpacePresetToValue(interimSpacePreset)
} }
} }
/// A wrapper around grid.interimSpace. /// A wrapper around grid.interimSpace.
@IBInspectable public var interimSpace: CGFloat { @IBInspectable public var interimSpace: InterimSpace {
get { get {
return contentView.grid.interimSpace return contentView.grid.interimSpace
} }
...@@ -308,9 +308,9 @@ public class MaterialCollectionViewCell : UICollectionViewCell { ...@@ -308,9 +308,9 @@ public class MaterialCollectionViewCell : UICollectionViewCell {
for the backing layer. This is the preferred method of setting depth for the backing layer. This is the preferred method of setting depth
in order to maintain consitency across UI objects. in order to maintain consitency across UI objects.
*/ */
public var depth: MaterialDepth { public var depthPreset {
didSet { didSet {
let value: MaterialDepthType = MaterialDepthToValue(depth) let value: Depth = DepthPresetToValue(preset)
shadowOffset = value.offset shadowOffset = value.offset
shadowOpacity = value.opacity shadowOpacity = value.opacity
shadowRadius = value.radius shadowRadius = value.radius
......
...@@ -38,14 +38,14 @@ public class MaterialCollectionViewLayout : UICollectionViewLayout { ...@@ -38,14 +38,14 @@ public class MaterialCollectionViewLayout : UICollectionViewLayout {
public var itemSize: CGSize = CGSize.zero public var itemSize: CGSize = CGSize.zero
/// A preset wrapper around contentInset. /// A preset wrapper around contentInset.
public var contentInsetPreset: MaterialEdgeInset = .None { public var contentInsetPreset: InsetsPreset = .none {
didSet { didSet {
contentInset = MaterialEdgeInsetToValue(contentInsetPreset) contentInset = InsetsPresetToValue(preset: contentInsetPreset)
} }
} }
/// A wrapper around grid.contentInset. /// A wrapper around grid.contentInset.
public var contentInset: UIEdgeInsets = UIEdgeInsetsZero public var contentInset = Insets.zero
/// Size of the content. /// Size of the content.
public private(set) var contentSize: CGSize = CGSize.zero public private(set) var contentSize: CGSize = CGSize.zero
...@@ -57,17 +57,17 @@ public class MaterialCollectionViewLayout : UICollectionViewLayout { ...@@ -57,17 +57,17 @@ public class MaterialCollectionViewLayout : UICollectionViewLayout {
public private(set) var dataSourceItems: Array<MaterialDataSourceItem>? public private(set) var dataSourceItems: Array<MaterialDataSourceItem>?
/// Scroll direction. /// Scroll direction.
public var scrollDirection: UICollectionViewScrollDirection = .Vertical public var scrollDirection: UICollectionViewScrollDirection = .vertical
/// A preset wrapper around interimSpace. /// A preset wrapper around interimSpace.
public var interimSpacePreset: InterimSpace = .none { public var interimSpacePreset: InterimSpacePreset = .none {
didSet { didSet {
interimSpace = InterimSpaceToValue(interimSpacePreset) interimSpace = InterimSpacePresetToValue(preset: interimSpacePreset)
} }
} }
/// Spacing between items. /// Spacing between items.
public var interimSpace: CGFloat = 0 public var interimSpace: InterimSpace = 0
/** /**
Retrieves the index paths for the items within the passed in CGRect. Retrieves the index paths for the items within the passed in CGRect.
......
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import UIKit
public typealias MaterialDepthType = (offset: CGSize, opacity: Float, radius: CGFloat)
public enum MaterialDepth {
case None
case Depth1
case Depth2
case Depth3
case Depth4
case Depth5
}
/// Converts the MaterialDepth enum to a MaterialDepthType value.
public func MaterialDepthToValue(depth: MaterialDepth) -> MaterialDepthType {
switch depth {
case .None:
return (offset: CGSize.zero, opacity: 0, radius: 0)
case .Depth1:
return (offset: CGSizeMake(0, 1), opacity: 0.3, radius: 1)
case .Depth2:
return (offset: CGSizeMake(0, 2), opacity: 0.3, radius: 2)
case .Depth3:
return (offset: CGSizeMake(0, 3), opacity: 0.3, radius: 3)
case .Depth4:
return (offset: CGSizeMake(0, 4), opacity: 0.3, radius: 4)
case .Depth5:
return (offset: CGSizeMake(0, 5), opacity: 0.3, radius: 5)
}
}
...@@ -194,9 +194,9 @@ public class MaterialTableViewCell : UITableViewCell { ...@@ -194,9 +194,9 @@ public class MaterialTableViewCell : UITableViewCell {
for the backing layer. This is the preferred method of setting depth for the backing layer. This is the preferred method of setting depth
in order to maintain consitency across UI objects. in order to maintain consitency across UI objects.
*/ */
public var depth: MaterialDepth = .None { public var depthPreset = .none {
didSet { didSet {
let value: MaterialDepthType = MaterialDepthToValue(depth) let value: Depth = DepthPresetToValue(preset)
shadowOffset = value.offset shadowOffset = value.offset
shadowOpacity = value.opacity shadowOpacity = value.opacity
shadowRadius = value.radius shadowRadius = value.radius
......
...@@ -49,14 +49,14 @@ public class Menu { ...@@ -49,14 +49,14 @@ public class Menu {
} }
/// A preset wrapper around interimSpace. /// A preset wrapper around interimSpace.
public var interimSpacePreset: InterimSpace = .none { public var interimSpacePreset: InterimSpacePreset = .none {
didSet { didSet {
interimSpace = InterimSpaceToValue(interimSpacePreset) interimSpace = InterimSpacePresetToValue(preset: interimSpacePreset)
} }
} }
/// The space between views. /// The space between views.
public var interimSpace: CGFloat { public var interimSpace: InterimSpace {
didSet { didSet {
reload() reload()
} }
...@@ -90,7 +90,7 @@ public class Menu { ...@@ -90,7 +90,7 @@ public class Menu {
- Parameter origin: The origin position of the Menu. - Parameter origin: The origin position of the Menu.
- Parameter interimSpace: The interimSpace size between views. - Parameter interimSpace: The interimSpace size between views.
*/ */
public init(origin: CGPoint, interimSpace: CGFloat = 16) { public init(origin: CGPoint, interimSpace: InterimSpace = 16) {
self.origin = origin self.origin = origin
self.interimSpace = interimSpace self.interimSpace = interimSpace
} }
......
...@@ -62,28 +62,28 @@ public class NavigationBar : UINavigationBar { ...@@ -62,28 +62,28 @@ public class NavigationBar : UINavigationBar {
} }
/// A preset wrapper around contentInset. /// A preset wrapper around contentInset.
public var contentInsetPreset: MaterialEdgeInset = .None { public var contentInsetPreset: InsetsPreset = .none {
didSet { didSet {
contentInset = MaterialEdgeInsetToValue(contentInsetPreset) contentInset = InsetsPresetToValue(preset: contentInsetPreset)
} }
} }
/// A wrapper around grid.contentInset. /// A wrapper around grid.contentInset.
@IBInspectable public var contentInset: UIEdgeInsets = UIEdgeInsetsZero { @IBInspectable public var contentInset: Insets = Insets.zero {
didSet { didSet {
layoutSubviews() layoutSubviews()
} }
} }
/// A preset wrapper around interimSpace. /// A preset wrapper around interimSpace.
public var interimSpacePreset: InterimSpace = .none { public var interimSpacePreset: InterimSpacePreset = .none {
didSet { didSet {
interimSpace = InterimSpaceToValue(interimSpacePreset) interimSpace = InterimSpacePresetToValue(preset: interimSpacePreset)
} }
} }
/// A wrapper around grid.interimSpace. /// A wrapper around grid.interimSpace.
@IBInspectable public var interimSpace: CGFloat = 0 { @IBInspectable public var interimSpace: InterimSpace = 0 {
didSet { didSet {
layoutSubviews() layoutSubviews()
} }
...@@ -226,9 +226,9 @@ public class NavigationBar : UINavigationBar { ...@@ -226,9 +226,9 @@ public class NavigationBar : UINavigationBar {
for the backing layer. This is the preferred method of setting depth for the backing layer. This is the preferred method of setting depth
in order to maintain consitency across UI objects. in order to maintain consitency across UI objects.
*/ */
public var depth: MaterialDepth = .None { public var depthPreset = .none {
didSet { didSet {
let value: MaterialDepthType = MaterialDepthToValue(depth) let value: Depth = DepthPresetToValue(preset)
shadowOffset = value.offset shadowOffset = value.offset
shadowOpacity = value.opacity shadowOpacity = value.opacity
shadowRadius = value.radius shadowRadius = value.radius
...@@ -431,7 +431,7 @@ public class NavigationBar : UINavigationBar { ...@@ -431,7 +431,7 @@ public class NavigationBar : UINavigationBar {
public func prepareView() { public func prepareView() {
barStyle = .Black barStyle = .Black
translucent = false translucent = false
depth = .Depth1 depth = .depth1
interimSpacePreset = .interimSpace1 interimSpacePreset = .interimSpace1
contentInsetPreset = .Square1 contentInsetPreset = .Square1
contentScaleFactor = Device.scale contentScaleFactor = Device.scale
......
...@@ -48,7 +48,7 @@ public extension UIViewController { ...@@ -48,7 +48,7 @@ public extension UIViewController {
if viewController is NavigationDrawerController { if viewController is NavigationDrawerController {
return viewController as? NavigationDrawerController return viewController as? NavigationDrawerController
} }
viewController = viewController?.parentViewController viewController = viewController?.parent
} }
return nil return nil
} }
...@@ -272,10 +272,10 @@ public class NavigationDrawerController : RootController, UIGestureRecognizerDel ...@@ -272,10 +272,10 @@ public class NavigationDrawerController : RootController, UIGestureRecognizerDel
public private(set) var isStatusBarHidden: Bool = false public private(set) var isStatusBarHidden: Bool = false
/** /**
A MaterialDepth property that is used to set the depth of the A DepthPreset property that is used to set the depth of the
leftView when opened. leftView when opened.
*/ */
public var depth: MaterialDepth = .Depth1 public var depthPreset = .depth1
/** /**
A View property that is used to hide and reveal the A View property that is used to hide and reveal the
......
...@@ -40,9 +40,9 @@ public class RaisedButton: Button { ...@@ -40,9 +40,9 @@ public class RaisedButton: Button {
*/ */
public override func prepareView() { public override func prepareView() {
super.prepareView() super.prepareView()
depth = .Depth1 depth = .depth1
cornerRadiusPreset = .Radius1 cornerRadiusPreset = .Radius1
contentEdgeInsetsPreset = .WideRectangle3 contentEdgeInsetsPreset = .WideRectangle3
backgroundColor = Color.white backgroundColor = Color.white
} }
} }
\ No newline at end of file
...@@ -157,9 +157,9 @@ public class TextView: UITextView { ...@@ -157,9 +157,9 @@ public class TextView: UITextView {
for the backing layer. This is the preferred method of setting depth for the backing layer. This is the preferred method of setting depth
in order to maintain consitency across UI objects. in order to maintain consitency across UI objects.
*/ */
public var depth: MaterialDepth = .None { public var depthPreset = .none {
didSet { didSet {
let value: MaterialDepthType = MaterialDepthToValue(depth) let value: Depth = DepthPresetToValue(preset)
shadowOffset = value.offset shadowOffset = value.offset
shadowOpacity = value.opacity shadowOpacity = value.opacity
shadowRadius = value.radius shadowRadius = value.radius
...@@ -286,14 +286,14 @@ public class TextView: UITextView { ...@@ -286,14 +286,14 @@ public class TextView: UITextView {
Text container UIEdgeInset preset property. This updates the Text container UIEdgeInset preset property. This updates the
textContainerInset property with a preset value. textContainerInset property with a preset value.
*/ */
public var textContainerInsetPreset: MaterialEdgeInset = .None { public var textContainerInsetPreset: InsetsPreset = .none {
didSet { didSet {
textContainerInset = MaterialEdgeInsetToValue(textContainerInsetPreset) textContainerInset = InsetsPresetToValue(preset: textContainerInsetPreset)
} }
} }
/// Text container UIEdgeInset property. /// Text container UIEdgeInset property.
public override var textContainerInset: UIEdgeInsets { public override var textContainerInset: Insets {
didSet { didSet {
reloadView() reloadView()
} }
...@@ -459,7 +459,7 @@ public class TextView: UITextView { ...@@ -459,7 +459,7 @@ public class TextView: UITextView {
*/ */
public func prepareView() { public func prepareView() {
contentScaleFactor = Device.scale contentScaleFactor = Device.scale
textContainerInset = MaterialEdgeInsetToValue(.None) textContainerInset = Insets.zero
backgroundColor = Color.white backgroundColor = Color.white
masksToBounds = false masksToBounds = false
removeNotificationHandlers() removeNotificationHandlers()
......
...@@ -253,9 +253,9 @@ public class View: UIView { ...@@ -253,9 +253,9 @@ public class View: UIView {
for the backing layer. This is the preferred method of setting depth for the backing layer. This is the preferred method of setting depth
in order to maintain consitency across UI objects. in order to maintain consitency across UI objects.
*/ */
public var depth: MaterialDepth = .None { public var depthPreset = .none {
didSet { didSet {
let value: MaterialDepthType = MaterialDepthToValue(depth: depth) let value: Depth = DepthPresetToValue(preset: depth)
shadowOffset = value.offset shadowOffset = value.offset
shadowOpacity = value.opacity shadowOpacity = value.opacity
shadowRadius = value.radius shadowRadius = value.radius
......
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