Commit 12fd3d0c by Daniel Dahan

development: progression updates

parent 4683c8fa
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
657CD02A1B8EE0D3008C0029 /* MaterialCard.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9A94D1081B8A3F5100F586A5 /* MaterialCard.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 657CD02A1B8EE0D3008C0029 /* MaterialCard.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9A94D1081B8A3F5100F586A5 /* MaterialCard.swift */; settings = {ATTRIBUTES = (Public, ); }; };
657CD02C1B8EE0D3008C0029 /* SideNavController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65B965861B8BEEC60055B139 /* SideNavController.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 657CD02C1B8EE0D3008C0029 /* SideNavController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65B965861B8BEEC60055B139 /* SideNavController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
657CD02D1B8EE0D3008C0029 /* MaterialButton.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65B9657D1B8A7C330055B139 /* MaterialButton.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 657CD02D1B8EE0D3008C0029 /* MaterialButton.swift in Headers */ = {isa = PBXBuildFile; fileRef = 65B9657D1B8A7C330055B139 /* MaterialButton.swift */; settings = {ATTRIBUTES = (Public, ); }; };
657CD02E1B8EE0D3008C0029 /* (null) in Headers */ = {isa = PBXBuildFile; settings = {ATTRIBUTES = (Public, ); }; };
657CD02F1B8EE0D3008C0029 /* ImageCard.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9A94D10A1B8A485C00F586A5 /* ImageCard.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 657CD02F1B8EE0D3008C0029 /* ImageCard.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9A94D10A1B8A485C00F586A5 /* ImageCard.swift */; settings = {ATTRIBUTES = (Public, ); }; };
65B9657E1B8A7C330055B139 /* MaterialButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B9657D1B8A7C330055B139 /* MaterialButton.swift */; }; 65B9657E1B8A7C330055B139 /* MaterialButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B9657D1B8A7C330055B139 /* MaterialButton.swift */; };
65B965871B8BEEC60055B139 /* SideNavController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B965861B8BEEC60055B139 /* SideNavController.swift */; }; 65B965871B8BEEC60055B139 /* SideNavController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65B965861B8BEEC60055B139 /* SideNavController.swift */; };
...@@ -35,6 +34,8 @@ ...@@ -35,6 +34,8 @@
963832881B8908180015F710 /* Layout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 963832871B8908180015F710 /* Layout.swift */; }; 963832881B8908180015F710 /* Layout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 963832871B8908180015F710 /* Layout.swift */; };
963832891B89097D0015F710 /* Layout.swift in Headers */ = {isa = PBXBuildFile; fileRef = 963832871B8908180015F710 /* Layout.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 963832891B89097D0015F710 /* Layout.swift in Headers */ = {isa = PBXBuildFile; fileRef = 963832871B8908180015F710 /* Layout.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96B57D4E1B90AF7D00DE7BBB /* MaterialTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96B57D4D1B90AF7D00DE7BBB /* MaterialTheme.swift */; }; 96B57D4E1B90AF7D00DE7BBB /* MaterialTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96B57D4D1B90AF7D00DE7BBB /* MaterialTheme.swift */; };
96C910ED1B95804B00E7CE5C /* MaterialTheme.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96B57D4D1B90AF7D00DE7BBB /* MaterialTheme.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96C910EE1B95804B00E7CE5C /* ImageRevealCard.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9A3A3B6F1B8EB582005F16BC /* ImageRevealCard.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9A3A3B701B8EB582005F16BC /* ImageRevealCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A3A3B6F1B8EB582005F16BC /* ImageRevealCard.swift */; }; 9A3A3B701B8EB582005F16BC /* ImageRevealCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A3A3B6F1B8EB582005F16BC /* ImageRevealCard.swift */; };
9A94D0F91B895C8C00F586A5 /* Roboto.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9AAC38531B89559900FE6B2D /* Roboto.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 9A94D0F91B895C8C00F586A5 /* Roboto.swift in Headers */ = {isa = PBXBuildFile; fileRef = 9AAC38531B89559900FE6B2D /* Roboto.swift */; settings = {ATTRIBUTES = (Public, ); }; };
9A94D0FA1B895EA500F586A5 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 963832631B88E5BF0015F710 /* LICENSE */; }; 9A94D0FA1B895EA500F586A5 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 963832631B88E5BF0015F710 /* LICENSE */; };
...@@ -271,7 +272,8 @@ ...@@ -271,7 +272,8 @@
657CD02A1B8EE0D3008C0029 /* MaterialCard.swift in Headers */, 657CD02A1B8EE0D3008C0029 /* MaterialCard.swift in Headers */,
657CD02C1B8EE0D3008C0029 /* SideNavController.swift in Headers */, 657CD02C1B8EE0D3008C0029 /* SideNavController.swift in Headers */,
657CD02D1B8EE0D3008C0029 /* MaterialButton.swift in Headers */, 657CD02D1B8EE0D3008C0029 /* MaterialButton.swift in Headers */,
657CD02E1B8EE0D3008C0029 /* (null) in Headers */, 96C910ED1B95804B00E7CE5C /* MaterialTheme.swift in Headers */,
96C910EE1B95804B00E7CE5C /* ImageRevealCard.swift in Headers */,
657CD02F1B8EE0D3008C0029 /* ImageCard.swift in Headers */, 657CD02F1B8EE0D3008C0029 /* ImageCard.swift in Headers */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
import UIKit import UIKit
public class BasicCard : MaterialCard { public class BasicCard : MaterialCard, Comparable, Equatable {
// //
// :name: layoutConstraints // :name: layoutConstraints
// //
...@@ -104,7 +104,7 @@ public class BasicCard : MaterialCard { ...@@ -104,7 +104,7 @@ public class BasicCard : MaterialCard {
l.setTranslatesAutoresizingMaskIntoConstraints(false) l.setTranslatesAutoresizingMaskIntoConstraints(false)
l.textColor = MaterialTheme.white.color l.textColor = MaterialTheme.white.color
l.backgroundColor = MaterialTheme.clear.color l.backgroundColor = MaterialTheme.clear.color
l.font = Roboto.lightWithSize(12) l.font = Roboto.lightWithSize(16)
l.numberOfLines = 0 l.numberOfLines = 0
l.lineBreakMode = .ByWordWrapping l.lineBreakMode = .ByWordWrapping
prepareCard() prepareCard()
...@@ -204,7 +204,7 @@ public class BasicCard : MaterialCard { ...@@ -204,7 +204,7 @@ public class BasicCard : MaterialCard {
// text // text
titleLabelContainer!.addConstraints(Layout.constraint("H:|-(verticalSpace)-[titleLabel]-(verticalSpace)-|", options: nil, metrics: ["verticalSpace": verticalSpace], views: ["titleLabel": titleLabel!])) titleLabelContainer!.addConstraints(Layout.constraint("H:|-(verticalSpace)-[titleLabel]-(verticalSpace)-|", options: nil, metrics: ["verticalSpace": verticalSpace], views: ["titleLabel": titleLabel!]))
titleLabelContainer!.addConstraints(Layout.constraint("V:|-(verticalSpace)-[titleLabel(height)]-(verticalSpace)-|", options: nil, metrics: ["verticalSpace": verticalSpace, "height": titleLabel!.font.pointSize], views: ["titleLabel": titleLabel!])) titleLabelContainer!.addConstraints(Layout.constraint("V:|-(verticalSpace)-[titleLabel(height)]-(verticalSpace)-|", options: nil, metrics: ["verticalSpace": verticalSpace, "height": titleLabel!.font.pointSize + verticalSpace], views: ["titleLabel": titleLabel!]))
} }
// detail // detail
...@@ -270,3 +270,23 @@ public class BasicCard : MaterialCard { ...@@ -270,3 +270,23 @@ public class BasicCard : MaterialCard {
} }
} }
} }
public func ==(lhs: BasicCard, rhs: BasicCard) -> Bool {
return lhs.tag == rhs.tag
}
public func <=(lhs: BasicCard, rhs: BasicCard) -> Bool {
return lhs.tag <= rhs.tag
}
public func >=(lhs: BasicCard, rhs: BasicCard) -> Bool {
return lhs.tag >= rhs.tag
}
public func >(lhs: BasicCard, rhs: BasicCard) -> Bool {
return lhs.tag > rhs.tag
}
public func <(lhs: BasicCard, rhs: BasicCard) -> Bool {
return lhs.tag < rhs.tag
}
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
import UIKit import UIKit
public class ImageCard : MaterialCard { public class ImageCard : MaterialCard, Comparable, Equatable {
// //
// :name: layoutConstraints // :name: layoutConstraints
// //
...@@ -29,31 +29,27 @@ public class ImageCard : MaterialCard { ...@@ -29,31 +29,27 @@ public class ImageCard : MaterialCard {
// //
internal lazy var views: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>() internal lazy var views: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
// /**
// :name: detailTextContainer :name: verticalSpace
// */
internal var detailTextContainer: UIView? public var verticalSpace: CGFloat = 8
// /**
// :name: buttonsContainer :name: maximumDetailHeight
// */
internal var buttonsContainer: UIView? public var maximumDetailHeight: CGFloat = 144
/**
:name: titleLabelContainer
*/
public private(set) var titleLabelContainer: UIView?
/** /**
:name: imageView :name: shadow
*/ */
public var imageView: UIImageView? { public var shadow: Bool = true {
didSet { didSet {
imageView!.setTranslatesAutoresizingMaskIntoConstraints(false) false == shadow ? removeShadow() : prepareShadow()
imageView!.contentMode = .ScaleAspectFill
imageView!.userInteractionEnabled = false
imageView!.clipsToBounds = true
insertSubview(imageView!, belowSubview: backgroundColorView)
if nil != titleLabel {
titleLabel!.removeFromSuperview()
imageView!.addSubview(titleLabel!)
}
prepareCard()
} }
} }
...@@ -62,39 +58,59 @@ public class ImageCard : MaterialCard { ...@@ -62,39 +58,59 @@ public class ImageCard : MaterialCard {
*/ */
public var titleLabel: UILabel? { public var titleLabel: UILabel? {
didSet { didSet {
titleLabel!.setTranslatesAutoresizingMaskIntoConstraints(false) if let t = titleLabel {
titleLabel!.textColor = MaterialTheme.white.color // container
titleLabel!.font = Roboto.regularWithSize(22) if nil == titleLabelContainer {
if nil == imageView { titleLabelContainer = UIView()
addSubview(titleLabel!) titleLabelContainer!.setTranslatesAutoresizingMaskIntoConstraints(false)
titleLabelContainer!.backgroundColor = MaterialTheme.clear.color
addSubview(titleLabelContainer!)
}
// text
titleLabelContainer!.addSubview(t)
t.setTranslatesAutoresizingMaskIntoConstraints(false)
t.textColor = MaterialTheme.white.color
t.backgroundColor = MaterialTheme.clear.color
t.font = Roboto.mediumWithSize(18)
t.numberOfLines = 1
} else { } else {
imageView!.addSubview(titleLabel!) titleLabelContainer?.removeFromSuperview()
} }
prepareCard()
} }
} }
/** /**
:name: detailTextLabel :name: detailLabelContainer
*/ */
public var detailTextLabel: UILabel? { public private(set) var detailLabelContainer: UIView?
/**
:name: detailLabel
*/
public var detailLabel: UILabel? {
didSet { didSet {
if let l = detailLabel {
// container // container
if nil == detailTextContainer { if nil == detailLabelContainer {
detailTextContainer = UIView() detailLabelContainer = UIView()
detailTextContainer!.setTranslatesAutoresizingMaskIntoConstraints(false) detailLabelContainer!.setTranslatesAutoresizingMaskIntoConstraints(false)
detailTextContainer!.backgroundColor = MaterialTheme.white.color detailLabelContainer!.backgroundColor = MaterialTheme.clear.color
addSubview(detailTextContainer!) addSubview(detailLabelContainer!)
} }
// text // text
detailTextContainer!.addSubview(detailTextLabel!) detailLabelContainer!.addSubview(l)
detailTextLabel!.setTranslatesAutoresizingMaskIntoConstraints(false) l.setTranslatesAutoresizingMaskIntoConstraints(false)
detailTextLabel!.textColor = MaterialTheme.black.color l.textColor = MaterialTheme.white.color
detailTextLabel!.font = Roboto.lightWithSize(16) l.backgroundColor = MaterialTheme.clear.color
detailTextLabel!.numberOfLines = 0 l.font = Roboto.lightWithSize(12)
detailTextLabel!.lineBreakMode = .ByWordWrapping l.numberOfLines = 0
l.lineBreakMode = .ByWordWrapping
prepareCard() prepareCard()
} else {
detailLabelContainer?.removeFromSuperview()
}
} }
} }
...@@ -103,25 +119,57 @@ public class ImageCard : MaterialCard { ...@@ -103,25 +119,57 @@ public class ImageCard : MaterialCard {
*/ */
public var divider: UIView? { public var divider: UIView? {
didSet { didSet {
divider!.setTranslatesAutoresizingMaskIntoConstraints(false) if let d = divider {
divider!.backgroundColor = MaterialTheme.blueGrey.lighten4 d.setTranslatesAutoresizingMaskIntoConstraints(false)
addSubview(divider!) d.backgroundColor = MaterialTheme.blueGrey.color
addSubview(d)
prepareCard()
} else {
divider?.removeFromSuperview()
}
}
}
/**
:name: buttonsContainer
*/
public private(set) var buttonsContainer: UIView?
/**
:name: leftButtons
*/
public var leftButtons: Array<MaterialButton>? {
didSet {
if let b = leftButtons {
if nil == buttonsContainer {
buttonsContainer = UIView()
buttonsContainer!.setTranslatesAutoresizingMaskIntoConstraints(false)
buttonsContainer!.backgroundColor = MaterialTheme.clear.color
addSubview(buttonsContainer!)
}
prepareCard() prepareCard()
} else {
buttonsContainer?.removeFromSuperview()
}
} }
} }
/** /**
:name: buttons :name: rightButtons
*/ */
public var buttons: Array<MaterialButton>? { public var rightButtons: Array<MaterialButton>? {
didSet { didSet {
if let b = rightButtons {
if nil == buttonsContainer { if nil == buttonsContainer {
buttonsContainer = UIView() buttonsContainer = UIView()
buttonsContainer!.setTranslatesAutoresizingMaskIntoConstraints(false) buttonsContainer!.setTranslatesAutoresizingMaskIntoConstraints(false)
buttonsContainer!.backgroundColor = MaterialTheme.white.color buttonsContainer!.backgroundColor = MaterialTheme.clear.color
addSubview(buttonsContainer!) addSubview(buttonsContainer!)
} }
prepareCard() prepareCard()
} else {
buttonsContainer?.removeFromSuperview()
}
} }
} }
...@@ -131,7 +179,7 @@ public class ImageCard : MaterialCard { ...@@ -131,7 +179,7 @@ public class ImageCard : MaterialCard {
internal override func prepareView() { internal override func prepareView() {
super.prepareView() super.prepareView()
prepareShadow() prepareShadow()
backgroundColor = MaterialTheme.clear.color backgroundColor = MaterialTheme.blueGrey.darken1
} }
// //
...@@ -139,6 +187,7 @@ public class ImageCard : MaterialCard { ...@@ -139,6 +187,7 @@ public class ImageCard : MaterialCard {
// //
internal override func prepareCard() { internal override func prepareCard() {
super.prepareCard() super.prepareCard()
// deactivate and clear all constraints // deactivate and clear all constraints
NSLayoutConstraint.deactivateConstraints(layoutConstraints) NSLayoutConstraint.deactivateConstraints(layoutConstraints)
layoutConstraints.removeAll(keepCapacity: false) layoutConstraints.removeAll(keepCapacity: false)
...@@ -146,66 +195,73 @@ public class ImageCard : MaterialCard { ...@@ -146,66 +195,73 @@ public class ImageCard : MaterialCard {
// detect all components and create constraints // detect all components and create constraints
var verticalFormat: String = "V:|" var verticalFormat: String = "V:|"
if nil != imageView {
layoutConstraints += Layout.constraint("H:|[imageView]|", options: nil, metrics: nil, views: ["imageView": imageView!])
verticalFormat += "[imageView(200)]"
views["imageView"] = imageView!
}
// title // title
if nil != titleLabel { if nil != titleLabelContainer && nil != titleLabel {
if nil == imageView { // container
layoutConstraints += Layout.constraint("H:|-(16)-[titleLabel]-(16)-|", options: nil, metrics: nil, views: ["titleLabel": titleLabel!]) layoutConstraints += Layout.constraint("H:|[titleLabelContainer]|", options: nil, metrics: nil, views: ["titleLabelContainer": titleLabelContainer!])
verticalFormat += "-(16)-[titleLabel(22)]" verticalFormat += "[titleLabelContainer]"
} else { views["titleLabelContainer"] = titleLabelContainer!
layoutConstraints += Layout.constraint("H:[titleLabel]-(16)-|", options: nil, metrics: nil, views: ["titleLabel": titleLabel!])
Layout.alignFromBottomLeft(imageView!, child: titleLabel!, bottom: 16, left: 16) // text
} titleLabelContainer!.addConstraints(Layout.constraint("H:|-(verticalSpace)-[titleLabel]-(verticalSpace)-|", options: nil, metrics: ["verticalSpace": verticalSpace], views: ["titleLabel": titleLabel!]))
views["titleLabel"] = titleLabel! titleLabelContainer!.addConstraints(Layout.constraint("V:|-(verticalSpace)-[titleLabel(height)]-(verticalSpace)-|", options: nil, metrics: ["verticalSpace": verticalSpace, "height": titleLabel!.font.pointSize], views: ["titleLabel": titleLabel!]))
} }
// details // detail
if nil != detailTextContainer && nil != detailTextLabel { if nil != detailLabelContainer && nil != detailLabel {
// container // container
layoutConstraints += Layout.constraint("H:|[detailTextContainer]|", options: nil, metrics: nil, views: ["detailTextContainer": detailTextContainer!]) layoutConstraints += Layout.constraint("H:|[detailLabelContainer]|", options: nil, metrics: nil, views: ["detailLabelContainer": detailLabelContainer!])
verticalFormat += "-(0)-[detailTextContainer]" verticalFormat += "[detailLabelContainer]"
views["detailTextContainer"] = detailTextContainer! views["detailLabelContainer"] = detailLabelContainer!
// text // text
layoutConstraints += Layout.constraint("H:|-(16)-[detailTextLabel]-(16)-|", options: nil, metrics: nil, views: ["detailTextLabel": detailTextLabel!]) detailLabelContainer!.addConstraints(Layout.constraint("H:|-(verticalSpace)-[detailLabel]-(verticalSpace)-|", options: nil, metrics: ["verticalSpace": verticalSpace], views: ["detailLabel": detailLabel!]))
layoutConstraints += Layout.constraint("V:|-(16)-[detailTextLabel(<=128)]-(16)-|", options: nil, metrics: nil, views: ["detailTextLabel": detailTextLabel!]) detailLabelContainer!.addConstraints(Layout.constraint("V:|-(verticalSpace)-[detailLabel(<=maximumDetailHeight)]-(verticalSpace)-|", options: nil, metrics: ["verticalSpace": verticalSpace, "maximumDetailHeight": maximumDetailHeight], views: ["detailLabel": detailLabel!]))
views["detailTextLabel"] = detailTextLabel!
} }
if nil != buttons && nil != buttonsContainer { if nil != buttonsContainer && (nil != leftButtons || nil != rightButtons) {
// divider // divider
if nil != divider { if nil != divider {
layoutConstraints += Layout.constraint("H:|[divider]|", options: nil, metrics: nil, views: ["divider": divider!]) layoutConstraints += Layout.constraint("H:|[divider]|", options: nil, metrics: nil, views: ["divider": divider!])
views["divider"] = divider! views["divider"] = divider!
verticalFormat += "-(0)-[divider(1)]" verticalFormat += "[divider(1)]"
} }
//container //container
layoutConstraints += Layout.constraint("H:|[buttonsContainer]|", options: nil, metrics: nil, views: ["buttonsContainer": buttonsContainer!]) layoutConstraints += Layout.constraint("H:|[buttonsContainer]|", options: nil, metrics: nil, views: ["buttonsContainer": buttonsContainer!])
verticalFormat += "-(0)-[buttonsContainer]|" verticalFormat += "[buttonsContainer]"
views["buttonsContainer"] = buttonsContainer! views["buttonsContainer"] = buttonsContainer!
// buttons // leftButtons
if nil != leftButtons {
var horizontalFormat: String = "H:|" var horizontalFormat: String = "H:|"
var buttonViews: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>() var buttonViews: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
for var i: Int = 0, l: Int = buttons!.count; i < l; ++i { for var i: Int = 0, l: Int = leftButtons!.count; i < l; ++i {
let button: MaterialButton = buttons![i] let button: MaterialButton = leftButtons![i]
buttonsContainer!.addSubview(button) buttonsContainer!.addSubview(button)
buttonViews["button\(i)"] = button buttonViews["button\(i)"] = button
views["button\(i)"] = button as AnyObject horizontalFormat += "-(verticalSpace)-[button\(i)]"
horizontalFormat += "-(8)-[button\(i)]" Layout.expandToParentVerticallyWithPad(buttonsContainer!, child: button, top: verticalSpace, bottom: verticalSpace)
layoutConstraints += Layout.constraint("V:|-(8)-[button\(i)]-(8)-|", options: nil, metrics: nil, views: views) }
buttonsContainer!.addConstraints(Layout.constraint(horizontalFormat, options: nil, metrics: ["verticalSpace": verticalSpace], views: buttonViews))
} }
layoutConstraints += Layout.constraint(horizontalFormat, options: nil, metrics: nil, views: buttonViews)
} else { // rightButtons
verticalFormat += "|" if nil != rightButtons {
var horizontalFormat: String = "H:"
var buttonViews: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
for var i: Int = 0, l: Int = rightButtons!.count; i < l; ++i {
let button: MaterialButton = rightButtons![i]
buttonsContainer!.addSubview(button)
buttonViews["button\(i)"] = button
horizontalFormat += "[button\(i)]-(verticalSpace)-"
Layout.expandToParentVerticallyWithPad(buttonsContainer!, child: button, top: verticalSpace, bottom: verticalSpace)
}
buttonsContainer!.addConstraints(Layout.constraint(horizontalFormat + "|", options: nil, metrics: ["verticalSpace": verticalSpace], views: buttonViews))
} }
}
verticalFormat += "|"
// combine constraints // combine constraints
if 0 < layoutConstraints.count { if 0 < layoutConstraints.count {
...@@ -214,3 +270,23 @@ public class ImageCard : MaterialCard { ...@@ -214,3 +270,23 @@ public class ImageCard : MaterialCard {
} }
} }
} }
public func ==(lhs: ImageCard, rhs: ImageCard) -> Bool {
return lhs.tag == rhs.tag
}
public func <=(lhs: ImageCard, rhs: ImageCard) -> Bool {
return lhs.tag <= rhs.tag
}
public func >=(lhs: ImageCard, rhs: ImageCard) -> Bool {
return lhs.tag >= rhs.tag
}
public func >(lhs: ImageCard, rhs: ImageCard) -> Bool {
return lhs.tag > rhs.tag
}
public func <(lhs: ImageCard, rhs: ImageCard) -> Bool {
return lhs.tag < rhs.tag
}
...@@ -85,7 +85,7 @@ public struct Layout { ...@@ -85,7 +85,7 @@ public struct Layout {
/** /**
:name: expandToParentWithPad :name: expandToParentWithPad
*/ */
public static func expandToParentWithPad(parent: UIView, child: UIView, left: CGFloat = 0, bottom: CGFloat = 0, right: CGFloat = 0, top: CGFloat = 0) { public static func expandToParentWithPad(parent: UIView, child: UIView, top: CGFloat = 0, left: CGFloat = 0, bottom: CGFloat = 0, right: CGFloat = 0) {
let views: Dictionary<String, AnyObject> = ["child" : child] let views: Dictionary<String, AnyObject> = ["child" : child]
parent.addConstraints(constraint("H:|-(left)-[child]-(right)-|", options: nil, metrics: ["left": left, "right": right], views: views)) parent.addConstraints(constraint("H:|-(left)-[child]-(right)-|", options: nil, metrics: ["left": left, "right": right], views: views))
parent.addConstraints(constraint("V:|-(top)-[child]-(bottom)-|", options: nil, metrics: ["bottom": bottom, "top": top], views: views)) parent.addConstraints(constraint("V:|-(top)-[child]-(bottom)-|", options: nil, metrics: ["bottom": bottom, "top": top], views: views))
......
...@@ -20,22 +20,22 @@ import UIKit ...@@ -20,22 +20,22 @@ import UIKit
public struct Roboto { public struct Roboto {
public static func lightWithSize(size: CGFloat) -> UIFont { public static func lightWithSize(size: CGFloat) -> UIFont {
if let light = UIFont(name: "Roboto-Light", size: size) { if let f = UIFont(name: "Roboto-Light", size: size) {
return light return f
} }
return UIFont.systemFontOfSize(size) return UIFont.systemFontOfSize(size)
} }
public static func mediumWithSize(size: CGFloat) -> UIFont { public static func mediumWithSize(size: CGFloat) -> UIFont {
if let light = UIFont(name: "Roboto-Medium", size: size) { if let f = UIFont(name: "Roboto-Medium", size: size) {
return light return f
} }
return UIFont.systemFontOfSize(size) return UIFont.systemFontOfSize(size)
} }
public static func regularWithSize(size: CGFloat) -> UIFont { public static func regularWithSize(size: CGFloat) -> UIFont {
if let light = UIFont(name: "Roboto-Regular", size: size) { if let f = UIFont(name: "Roboto-Regular", size: size) {
return light return f
} }
return UIFont.systemFontOfSize(size) return UIFont.systemFontOfSize(size)
} }
......
...@@ -66,7 +66,7 @@ public class TextView: UITextView { ...@@ -66,7 +66,7 @@ public class TextView: UITextView {
:name: placeholderColor :name: placeholderColor
:description: The placeholder color. :description: The placeholder color.
*/ */
public var placeholderColor: UIColor = MaterialTheme.blueGrey.lighten3 { public var placeholderColor: UIColor = MaterialTheme.blueGrey.lighten1 {
didSet { didSet {
label.textColor = placeholderColor label.textColor = placeholderColor
} }
...@@ -143,7 +143,7 @@ public class TextView: UITextView { ...@@ -143,7 +143,7 @@ public class TextView: UITextView {
backgroundColor = MaterialTheme.clear.color backgroundColor = MaterialTheme.clear.color
textColor = MaterialTheme.black.color textColor = MaterialTheme.black.color
label.font = font label.font = font
label.textColor = MaterialTheme.blueGrey.lighten3 label.textColor = placeholderColor
label.textAlignment = textAlignment label.textAlignment = textAlignment
label.text = placeholder label.text = placeholder
label.numberOfLines = 0 label.numberOfLines = 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment