Commit b639eaf4 by M. Porooshani

Updated the Material project to new Layout API

parent 468b271b
...@@ -234,7 +234,7 @@ public class BottomTabBar : UITabBar { ...@@ -234,7 +234,7 @@ public class BottomTabBar : UITabBar {
if autoLayoutToSuperview { if autoLayoutToSuperview {
if let v: UIView = superview { if let v: UIView = superview {
v.layout(self).bottom() v.layout(self).bottom()
v.layout.horizontally(self) v.layout(self).horizontally()
} }
} }
} }
......
...@@ -277,7 +277,7 @@ public class CardView : MaterialPulseView { ...@@ -277,7 +277,7 @@ public class CardView : MaterialPulseView {
verticalFormat += "-[titleLabel]" verticalFormat += "-[titleLabel]"
views["titleLabel"] = v views["titleLabel"] = v
layout.horizontally(v, left: contentInset.left + titleLabelInset.left, right: contentInset.right + titleLabelInset.right) layout(v).horizontally(left: contentInset.left + titleLabelInset.left, right: contentInset.right + titleLabelInset.right)
} }
// detail // detail
...@@ -292,7 +292,7 @@ public class CardView : MaterialPulseView { ...@@ -292,7 +292,7 @@ public class CardView : MaterialPulseView {
verticalFormat += "-[contentView]" verticalFormat += "-[contentView]"
views["contentView"] = v views["contentView"] = v
layout.horizontally(v, left: contentInset.left + contentViewInset.left, right: contentInset.right + contentViewInset.right) layout(v).horizontally(left: contentInset.left + contentViewInset.left, right: contentInset.right + contentViewInset.right)
} }
// leftButtons // leftButtons
...@@ -314,7 +314,7 @@ public class CardView : MaterialPulseView { ...@@ -314,7 +314,7 @@ public class CardView : MaterialPulseView {
h += "[\(k)]" h += "[\(k)]"
layout.bottom(b, bottom: contentInset.bottom + leftButtonsInset.bottom) layout(b).bottom(contentInset.bottom + leftButtonsInset.bottom)
i += 1 i += 1
} }
...@@ -343,7 +343,7 @@ public class CardView : MaterialPulseView { ...@@ -343,7 +343,7 @@ public class CardView : MaterialPulseView {
h += "-(right_left)-" h += "-(right_left)-"
} }
layout.bottom(b, bottom: contentInset.bottom + rightButtonsInset.bottom) layout(b).bottom(contentInset.bottom + rightButtonsInset.bottom)
i -= 1 i -= 1
} }
......
...@@ -378,9 +378,9 @@ public class ImageCardView : MaterialPulseView { ...@@ -378,9 +378,9 @@ public class ImageCardView : MaterialPulseView {
verticalFormat += "-[titleLabel]" verticalFormat += "-[titleLabel]"
views["titleLabel"] = v views["titleLabel"] = v
} else { } else {
layout.top(v, top: contentInset.top + titleLabelInset.top) layout(v).top(contentInset.top + titleLabelInset.top)
} }
layout.horizontally(v, left: contentInset.left + titleLabelInset.left, right: contentInset.right + titleLabelInset.right) layout(v).horizontally(left: contentInset.left + titleLabelInset.left, right: contentInset.right + titleLabelInset.right)
} }
// detail // detail
...@@ -395,7 +395,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -395,7 +395,7 @@ public class ImageCardView : MaterialPulseView {
verticalFormat += "-[contentView]" verticalFormat += "-[contentView]"
views["contentView"] = v views["contentView"] = v
layout.horizontally(v, left: contentInset.left + contentViewInset.left, right: contentInset.right + contentViewInset.right) layout(v).horizontally(left: contentInset.left + contentViewInset.left, right: contentInset.right + contentViewInset.right)
} }
// leftButtons // leftButtons
...@@ -417,7 +417,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -417,7 +417,7 @@ public class ImageCardView : MaterialPulseView {
h += "[\(k)]" h += "[\(k)]"
layout.bottom(b, bottom: contentInset.bottom + leftButtonsInset.bottom) layout(b).bottom(contentInset.bottom + leftButtonsInset.bottom)
i += 1 i += 1
} }
...@@ -446,7 +446,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -446,7 +446,7 @@ public class ImageCardView : MaterialPulseView {
h += "-(right_left)-" h += "-(right_left)-"
} }
layout.bottom(b, bottom: contentInset.bottom + rightButtonsInset.bottom) layout(b).bottom(contentInset.bottom + rightButtonsInset.bottom)
i -= 1 i -= 1
} }
......
...@@ -95,7 +95,7 @@ public class Layout { ...@@ -95,7 +95,7 @@ public class Layout {
/// Size (Assuming a child context) /// Size (Assuming a child context)
/// - returns: current layout instance /// - returns: current layout instance
public func size(width: CGFloat, height: CGFloat) -> Layout { public func size(width width: CGFloat, height: CGFloat) -> Layout {
if let c: UIView = childContext { if let c: UIView = childContext {
size(c, width: width, height: height) size(c, width: width, height: height)
} }
...@@ -131,7 +131,7 @@ public class Layout { ...@@ -131,7 +131,7 @@ public class Layout {
/// Horizontally aligned (Assuming a child context) /// Horizontally aligned (Assuming a child context)
/// - returns: current layout instance /// - returns: current layout instance
public func horizontally(left: CGFloat = 0, right: CGFloat = 0) -> Layout { public func horizontally(left left: CGFloat = 0, right: CGFloat = 0) -> Layout {
if let c: UIView = childContext { if let c: UIView = childContext {
horizontally(c, left: left, right: right) horizontally(c, left: left, right: right)
} }
...@@ -149,7 +149,7 @@ public class Layout { ...@@ -149,7 +149,7 @@ public class Layout {
/// Vertically aligned (Assuming a child context) /// Vertically aligned (Assuming a child context)
/// - returns: current layout instance /// - returns: current layout instance
public func vertically(top: CGFloat = 0, bottom: CGFloat = 0) -> Layout { public func vertically(top top: CGFloat = 0, bottom: CGFloat = 0) -> Layout {
if let c: UIView = childContext { if let c: UIView = childContext {
vertically(c, top: top, bottom: bottom) vertically(c, top: top, bottom: bottom)
} }
...@@ -167,7 +167,7 @@ public class Layout { ...@@ -167,7 +167,7 @@ public class Layout {
/// Center (Assuming a child context) /// Center (Assuming a child context)
/// - returns: current layout instance /// - returns: current layout instance
public func center(constantX: CGFloat = 0, constantY: CGFloat = 0) -> Layout { public func center(constantX constantX: CGFloat = 0, constantY: CGFloat = 0) -> Layout {
if let c: UIView = childContext { if let c: UIView = childContext {
center(c, constantX: constantX, constantY: constantY) center(c, constantX: constantX, constantY: constantY)
} }
...@@ -221,7 +221,7 @@ public class Layout { ...@@ -221,7 +221,7 @@ public class Layout {
/// Align Edges (Assuming a child context) /// Align Edges (Assuming a child context)
/// - returns: current layout instance /// - returns: current layout instance
public func edges(top: CGFloat = 0, left: CGFloat = 0, bottom: CGFloat = 0, right: CGFloat = 0) -> Layout { public func edges(top top: CGFloat = 0, left: CGFloat = 0, bottom: CGFloat = 0, right: CGFloat = 0) -> Layout {
if let c: UIView = childContext { if let c: UIView = childContext {
edges(c, top: top, left: left, bottom: bottom, right: right) edges(c, top: top, left: left, bottom: bottom, right: right)
} }
...@@ -239,7 +239,7 @@ public class Layout { ...@@ -239,7 +239,7 @@ public class Layout {
/// Align to TopLeft (Assuming a child context) /// Align to TopLeft (Assuming a child context)
/// - returns: current layout instance /// - returns: current layout instance
public func topLeft(top: CGFloat = 0, left: CGFloat = 0) -> Layout { public func topLeft(top top: CGFloat = 0, left: CGFloat = 0) -> Layout {
if let c: UIView = childContext { if let c: UIView = childContext {
topLeft(c, top: top, left: left) topLeft(c, top: top, left: left)
} }
...@@ -257,7 +257,7 @@ public class Layout { ...@@ -257,7 +257,7 @@ public class Layout {
/// Align to TopRight (Assuming a child context) /// Align to TopRight (Assuming a child context)
/// - returns: current layout instance /// - returns: current layout instance
public func topRight(top: CGFloat = 0, right: CGFloat = 0) -> Layout { public func topRight(top top: CGFloat = 0, right: CGFloat = 0) -> Layout {
if let c: UIView = childContext { if let c: UIView = childContext {
topRight(c, top: top, right: right) topRight(c, top: top, right: right)
} }
...@@ -275,7 +275,7 @@ public class Layout { ...@@ -275,7 +275,7 @@ public class Layout {
/// Align to BottomLeft (Assuming a child context) /// Align to BottomLeft (Assuming a child context)
/// - returns: current layout instance /// - returns: current layout instance
public func bottomLeft(bottom: CGFloat = 0, left: CGFloat = 0) -> Layout { public func bottomLeft(bottom bottom: CGFloat = 0, left: CGFloat = 0) -> Layout {
if let c: UIView = childContext { if let c: UIView = childContext {
bottomLeft(c, bottom: bottom, left: left) bottomLeft(c, bottom: bottom, left: left)
} }
...@@ -294,7 +294,7 @@ public class Layout { ...@@ -294,7 +294,7 @@ public class Layout {
/// Align to BottomRight (Assuming a child context) /// Align to BottomRight (Assuming a child context)
/// - returns: current layout instance /// - returns: current layout instance
public func bottomRight(bottom: CGFloat = 0, right: CGFloat = 0) -> Layout { public func bottomRight(bottom bottom: CGFloat = 0, right: CGFloat = 0) -> Layout {
if let c: UIView = childContext { if let c: UIView = childContext {
bottomRight(c, bottom: bottom, right: right) bottomRight(c, bottom: bottom, right: right)
} }
......
...@@ -401,7 +401,7 @@ public class TextView: UITextView { ...@@ -401,7 +401,7 @@ public class TextView: UITextView {
internal func reloadView() { internal func reloadView() {
if let p = placeholderLabel { if let p = placeholderLabel {
removeConstraints(constraints) removeConstraints(constraints)
layout.edges(p, layout(p).edges(
top: textContainerInset.top, top: textContainerInset.top,
left: textContainerInset.left + textContainer.lineFragmentPadding, left: textContainerInset.left + textContainer.lineFragmentPadding,
bottom: textContainerInset.bottom, bottom: textContainerInset.bottom,
......
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