Commit fa7a3d7b by Daniel Dahan

Merge branch 'development'

parents fdd82fe0 baf5f068
Pod::Spec.new do |s|
s.name = 'MK'
s.version = '1.11.0'
s.version = '1.12.0'
s.license = { :type => "AGPLv3+", :file => "LICENSE" }
s.summary = 'A Material Design Framework In Swift'
s.homepage = 'http://materialkit.io'
......
......@@ -30,38 +30,124 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
internal lazy var views: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
/**
:name: verticalTitleLabelSpace
:name: titleLabelVerticalInset
*/
public var verticalTitleLabelSpace: CGFloat = MaterialTheme.verticalSpace
public var titleLabelVerticalInset: CGFloat = MaterialTheme.verticalInset {
didSet {
titleLabelTopInset = titleLabelVerticalInset
titleLabelBottomInset = titleLabelVerticalInset
}
}
/**
:name: titleLabelTopInset
*/
public var titleLabelTopInset: CGFloat = MaterialTheme.verticalInset
/**
:name: titleLabelBottomInset
*/
public var titleLabelBottomInset: CGFloat = MaterialTheme.verticalInset
/**
:name: titleLabelHorizontalInset
*/
public var titleLabelHorizontalInset: CGFloat = MaterialTheme.horizontalInset {
didSet {
titleLabelLeftInset = titleLabelHorizontalInset
titleLabelRightInset = titleLabelHorizontalInset
}
}
/**
:name: horizontalTitleLabelSpace
:name: titleLabelLeftInset
*/
public var horizontalTitleLabelSpace: CGFloat = MaterialTheme.horizontalSpace
public var titleLabelLeftInset: CGFloat = MaterialTheme.horizontalInset
/**
:name: verticalDetailLabelSpace
:name: titleLabelRightInset
*/
public var verticalDetailLabelSpace: CGFloat = MaterialTheme.verticalSpace
public var titleLabelRightInset: CGFloat = MaterialTheme.horizontalInset
/**
:name: horizontalDetailLabelSpace
:name: detailLabelVerticalInset
*/
public var horizontalDetailLabelSpace: CGFloat = MaterialTheme.horizontalSpace
public var detailLabelVerticalInset: CGFloat = MaterialTheme.verticalInset {
didSet {
detailLabelTopInset = detailLabelVerticalInset
detailLabelBottomInset = detailLabelVerticalInset
}
}
/**
:name: verticalButtonSpace
:name: detailLabelTopInset
*/
public var verticalButtonSpace: CGFloat = MaterialTheme.verticalSpace
public var detailLabelTopInset: CGFloat = MaterialTheme.verticalInset
/**
:name: detailLabelBottomInset
*/
public var detailLabelBottomInset: CGFloat = MaterialTheme.verticalInset
/**
:name: detailLabelHorizontalInset
*/
public var detailLabelHorizontalInset: CGFloat = MaterialTheme.horizontalInset {
didSet {
detailLabelLeftInset = detailLabelHorizontalInset
detailLabelRightInset = detailLabelHorizontalInset
}
}
/**
:name: detailLabelLeftInset
*/
public var detailLabelLeftInset: CGFloat = MaterialTheme.horizontalInset
/**
:name: detailLabelRightInset
*/
public var detailLabelRightInset: CGFloat = MaterialTheme.horizontalInset
/**
:name: buttonVerticalInset
*/
public var buttonVerticalInset: CGFloat = MaterialTheme.verticalInset {
didSet {
buttonTopInset = buttonVerticalInset
buttonBottomInset = buttonVerticalInset
}
}
/**
:name: buttonTopInset
*/
public var buttonTopInset: CGFloat = MaterialTheme.verticalInset
/**
:name: buttonBottomInset
*/
public var buttonBottomInset: CGFloat = MaterialTheme.verticalInset
/**
:name: buttonHorizontalInset
*/
public var buttonHorizontalInset: CGFloat = MaterialTheme.horizontalInset {
didSet {
buttonLeftInset = buttonHorizontalInset
buttonRightInset = buttonHorizontalInset
}
}
/**
:name: horizontalButtonSpace
:name: buttonLeftInset
*/
public var horizontalButtonSpace: CGFloat = MaterialTheme.horizontalSpace
public var buttonLeftInset: CGFloat = MaterialTheme.horizontalInset
/**
:name: horizontalButtonSpace
:name: buttonRightInset
*/
public var buttonRightInset: CGFloat = MaterialTheme.horizontalInset
/**
:name: titleLabelContainer
......@@ -271,8 +357,7 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
// common text
Layout.height(titleLabelContainer!, child: titleLabel!, height: 1.5 * titleLabel!.font.pointSize)
Layout.expandToParentVerticallyWithPad(titleLabelContainer!, child: titleLabel!, top: verticalTitleLabelSpace, bottom: verticalTitleLabelSpace)
Layout.expandToParentHorizontallyWithPad(titleLabelContainer!, child: titleLabel!, left: horizontalTitleLabelSpace, right: horizontalTitleLabelSpace)
Layout.expandToParentWithPad(titleLabelContainer!, child: titleLabel!, top: titleLabelTopInset, left: titleLabelLeftInset, bottom: titleLabelBottomInset, right: titleLabelRightInset)
}
// detail
......@@ -286,8 +371,8 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
views["detailLabelContainer"] = detailLabelContainer!
// text
Layout.expandToParentHorizontallyWithPad(detailLabelContainer!, child: detailLabel!, left: horizontalDetailLabelSpace, right: horizontalDetailLabelSpace)
detailLabelContainer!.addConstraints(Layout.constraint("V:|-(verticalDetailLabelSpace)-[detailLabel(<=maximumDetailLabelHeight)]-(verticalDetailLabelSpace)-|", options: nil, metrics: ["verticalDetailLabelSpace": verticalDetailLabelSpace, "maximumDetailLabelHeight": maximumDetailLabelHeight], views: ["detailLabel": detailLabel!]))
Layout.expandToParentHorizontallyWithPad(detailLabelContainer!, child: detailLabel!, left: detailLabelLeftInset, right: detailLabelRightInset)
detailLabelContainer!.addConstraints(Layout.constraint("V:|-(detailLabelTopInset)-[detailLabel(<=maximumDetailLabelHeight)]-(detailLabelBottomInset)-|", options: nil, metrics: ["detailLabelTopInset": detailLabelTopInset, "detailLabelBottomInset": detailLabelBottomInset, "maximumDetailLabelHeight": maximumDetailLabelHeight], views: ["detailLabel": detailLabel!]))
}
// buttons
......@@ -315,10 +400,10 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
let button: MaterialButton = leftButtons![i]
buttonsContainer!.addSubview(button)
buttonViews["button\(i)"] = button
horizontalFormat += "-(horizontalButtonSpace)-[button\(i)]"
Layout.expandToParentVerticallyWithPad(buttonsContainer!, child: button, top: verticalButtonSpace, bottom: verticalButtonSpace)
horizontalFormat += "-(buttonLeftInset)-[button\(i)]"
Layout.expandToParentVerticallyWithPad(buttonsContainer!, child: button, top: buttonTopInset, bottom: buttonBottomInset)
}
buttonsContainer!.addConstraints(Layout.constraint(horizontalFormat, options: nil, metrics: ["horizontalButtonSpace": horizontalButtonSpace], views: buttonViews))
buttonsContainer!.addConstraints(Layout.constraint(horizontalFormat, options: nil, metrics: ["buttonLeftInset": buttonLeftInset], views: buttonViews))
}
// rightButtons
......@@ -329,10 +414,10 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
let button: MaterialButton = rightButtons![i]
buttonsContainer!.addSubview(button)
buttonViews["button\(i)"] = button
horizontalFormat += "[button\(i)]-(horizontalButtonSpace)-"
Layout.expandToParentVerticallyWithPad(buttonsContainer!, child: button, top: verticalButtonSpace, bottom: verticalButtonSpace)
horizontalFormat += "[button\(i)]-(buttonRightInset)-"
Layout.expandToParentVerticallyWithPad(buttonsContainer!, child: button, top: buttonTopInset, bottom: buttonBottomInset)
}
buttonsContainer!.addConstraints(Layout.constraint(horizontalFormat + "|", options: nil, metrics: ["horizontalButtonSpace": horizontalButtonSpace], views: buttonViews))
buttonsContainer!.addConstraints(Layout.constraint(horizontalFormat + "|", options: nil, metrics: ["buttonRightInset": buttonRightInset], views: buttonViews))
}
}
......
......@@ -30,44 +30,158 @@ public class ImageCardView : MaterialCardView, Comparable, Equatable {
internal lazy var views: Dictionary<String, AnyObject> = Dictionary<String, AnyObject>()
/**
:name: verticalImageViewSpace
:name: imageViewVerticalInset
*/
public var verticalImageViewSpace: CGFloat = 0
public var imageViewVerticalInset: CGFloat = 0 {
didSet {
imageViewTopInset = imageViewVerticalInset
imageViewBottomInset = imageViewVerticalInset
}
}
/**
:name: imageViewTopInset
*/
public var imageViewTopInset: CGFloat = 0
/**
:name: imageViewBottomInset
*/
public var imageViewBottomInset: CGFloat = 0
/**
:name: horizontalImageViewSpace
:name: imageViewHorizontalInset
*/
public var horizontalImageViewSpace: CGFloat = 0
public var imageViewHorizontalInset: CGFloat = 0 {
didSet {
imageViewLeftInset = imageViewHorizontalInset
imageViewRightInset = imageViewHorizontalInset
}
}
/**
:name: verticalTitleLabelSpace
:name: imageViewLeftInset
*/
public var verticalTitleLabelSpace: CGFloat = MaterialTheme.verticalSpace
public var imageViewLeftInset: CGFloat = 0
/**
:name: horizontalTitleLabelSpace
:name: imageViewRightInset
*/
public var horizontalTitleLabelSpace: CGFloat = MaterialTheme.horizontalSpace
public var imageViewRightInset: CGFloat = 0
/**
:name: titleLabelVerticalInset
*/
public var titleLabelVerticalInset: CGFloat = MaterialTheme.verticalInset {
didSet {
titleLabelBottomInset = titleLabelVerticalInset
}
}
/**
:name: verticalDetailLabelSpace
:name: titleLabelBottomInset
*/
public var verticalDetailLabelSpace: CGFloat = MaterialTheme.verticalSpace
public var titleLabelBottomInset: CGFloat = MaterialTheme.verticalInset
/**
:name: horizontalDetailLabelSpace
:name: titleLabelHorizontalInset
*/
public var horizontalDetailLabelSpace: CGFloat = MaterialTheme.horizontalSpace
public var titleLabelHorizontalInset: CGFloat = MaterialTheme.horizontalInset {
didSet {
titleLabelLeftInset = titleLabelHorizontalInset
titleLabelRightInset = titleLabelHorizontalInset
}
}
/**
:name: titleLabelLeftInset
*/
public var titleLabelLeftInset: CGFloat = MaterialTheme.horizontalInset
/**
:name: titleLabelRightInset
*/
public var titleLabelRightInset: CGFloat = MaterialTheme.horizontalInset
/**
:name: detailLabelVerticalInset
*/
public var detailLabelVerticalInset: CGFloat = MaterialTheme.verticalInset {
didSet {
detailLabelTopInset = detailLabelVerticalInset
detailLabelBottomInset = detailLabelVerticalInset
}
}
/**
:name: detailLabelTopInset
*/
public var detailLabelTopInset: CGFloat = MaterialTheme.verticalInset
/**
:name: detailLabelBottomInset
*/
public var detailLabelBottomInset: CGFloat = MaterialTheme.verticalInset
/**
:name: detailLabelHorizontalInset
*/
public var detailLabelHorizontalInset: CGFloat = MaterialTheme.horizontalInset {
didSet {
detailLabelLeftInset = detailLabelHorizontalInset
detailLabelRightInset = detailLabelHorizontalInset
}
}
/**
:name: detailLabelLeftInset
*/
public var detailLabelLeftInset: CGFloat = MaterialTheme.horizontalInset
/**
:name: detailLabelRightInset
*/
public var detailLabelRightInset: CGFloat = MaterialTheme.horizontalInset
/**
:name: buttonVerticalInset
*/
public var buttonVerticalInset: CGFloat = MaterialTheme.verticalInset {
didSet {
buttonTopInset = buttonVerticalInset
buttonBottomInset = buttonVerticalInset
}
}
/**
:name: buttonTopInset
*/
public var buttonTopInset: CGFloat = MaterialTheme.verticalInset
/**
:name: buttonBottomInset
*/
public var buttonBottomInset: CGFloat = MaterialTheme.verticalInset
/**
:name: buttonHorizontalInset
*/
public var buttonHorizontalInset: CGFloat = MaterialTheme.horizontalInset {
didSet {
buttonLeftInset = buttonHorizontalInset
buttonRightInset = buttonHorizontalInset
}
}
/**
:name: verticalButtonSpace
:name: buttonLeftInset
*/
public var verticalButtonSpace: CGFloat = MaterialTheme.verticalSpace
public var buttonLeftInset: CGFloat = MaterialTheme.horizontalInset
/**
:name: horizontalButtonSpace
:name: buttonRightInset
*/
public var horizontalButtonSpace: CGFloat = MaterialTheme.horizontalSpace
public var buttonRightInset: CGFloat = MaterialTheme.horizontalInset
/**
:name: shadow
......@@ -327,8 +441,8 @@ public class ImageCardView : MaterialCardView, Comparable, Equatable {
views["imageViewContainer"] = imageViewContainer!
// text
imageViewContainer!.addConstraints(Layout.constraint("H:|-(horizontalImageViewSpace)-[imageView]-(horizontalImageViewSpace)-|", options: nil, metrics: ["horizontalImageViewSpace": horizontalImageViewSpace], views: ["imageView": imageView!]))
imageViewContainer!.addConstraints(Layout.constraint("V:|-(verticalImageViewSpace)-[imageView(maximumImageViewHeight)]-(verticalImageViewSpace)-|", options: nil, metrics: ["verticalImageViewSpace": verticalImageViewSpace, "maximumImageViewHeight": maximumImageViewHeight], views: ["imageView": imageView!]))
Layout.expandToParentHorizontallyWithPad(imageViewContainer!, child: imageView!, left: imageViewLeftInset, right: imageViewRightInset)
imageViewContainer!.addConstraints(Layout.constraint("V:|-(imageViewTopInset)-[imageView(maximumImageViewHeight)]-(imageViewBottomInset)-|", options: nil, metrics: ["imageViewTopInset": imageViewTopInset, "imageViewBottomInset": imageViewBottomInset, "maximumImageViewHeight": maximumImageViewHeight], views: ["imageView": imageView!]))
}
// title
......@@ -349,8 +463,7 @@ public class ImageCardView : MaterialCardView, Comparable, Equatable {
// common text
Layout.height(titleLabelContainer!, child: titleLabel!, height: 1.5 * titleLabel!.font.pointSize)
Layout.expandToParentVerticallyWithPad(titleLabelContainer!, child: titleLabel!, top: verticalTitleLabelSpace, bottom: verticalTitleLabelSpace)
Layout.expandToParentHorizontallyWithPad(titleLabelContainer!, child: titleLabel!, left: horizontalTitleLabelSpace, right: horizontalTitleLabelSpace)
Layout.expandToParentWithPad(titleLabelContainer!, child: titleLabel!, left: titleLabelLeftInset, bottom: titleLabelBottomInset, right: titleLabelRightInset)
}
// detail
......@@ -364,8 +477,8 @@ public class ImageCardView : MaterialCardView, Comparable, Equatable {
views["detailLabelContainer"] = detailLabelContainer!
// text
Layout.expandToParentHorizontallyWithPad(detailLabelContainer!, child: detailLabel!, left: horizontalDetailLabelSpace, right: horizontalDetailLabelSpace)
detailLabelContainer!.addConstraints(Layout.constraint("V:|-(verticalDetailLabelSpace)-[detailLabel(<=maximumDetailLabelHeight)]-(verticalDetailLabelSpace)-|", options: nil, metrics: ["verticalDetailLabelSpace": verticalDetailLabelSpace, "maximumDetailLabelHeight": maximumDetailLabelHeight], views: ["detailLabel": detailLabel!]))
Layout.expandToParentHorizontallyWithPad(detailLabelContainer!, child: detailLabel!, left: detailLabelLeftInset, right: detailLabelRightInset)
detailLabelContainer!.addConstraints(Layout.constraint("V:|-(detailLabelTopInset)-[detailLabel(<=maximumDetailLabelHeight)]-(detailLabelBottomInset)-|", options: nil, metrics: ["detailLabelTopInset": detailLabelTopInset, "detailLabelBottomInset": detailLabelBottomInset, "maximumDetailLabelHeight": maximumDetailLabelHeight], views: ["detailLabel": detailLabel!]))
}
// buttons
......@@ -393,10 +506,10 @@ public class ImageCardView : MaterialCardView, Comparable, Equatable {
let button: MaterialButton = leftButtons![i]
buttonsContainer!.addSubview(button)
buttonViews["button\(i)"] = button
horizontalFormat += "-(horizontalButtonSpace)-[button\(i)]"
Layout.expandToParentVerticallyWithPad(buttonsContainer!, child: button, top: verticalButtonSpace, bottom: verticalButtonSpace)
horizontalFormat += "-(buttonLeftInset)-[button\(i)]"
Layout.expandToParentVerticallyWithPad(buttonsContainer!, child: button, top: buttonTopInset, bottom: buttonBottomInset)
}
buttonsContainer!.addConstraints(Layout.constraint(horizontalFormat, options: nil, metrics: ["horizontalButtonSpace": horizontalButtonSpace], views: buttonViews))
buttonsContainer!.addConstraints(Layout.constraint(horizontalFormat, options: nil, metrics: ["buttonLeftInset": buttonLeftInset], views: buttonViews))
}
// rightButtons
......@@ -407,10 +520,10 @@ public class ImageCardView : MaterialCardView, Comparable, Equatable {
let button: MaterialButton = rightButtons![i]
buttonsContainer!.addSubview(button)
buttonViews["button\(i)"] = button
horizontalFormat += "[button\(i)]-(horizontalButtonSpace)-"
Layout.expandToParentVerticallyWithPad(buttonsContainer!, child: button, top: verticalButtonSpace, bottom: verticalButtonSpace)
horizontalFormat += "[button\(i)]-(buttonRightInset)-"
Layout.expandToParentVerticallyWithPad(buttonsContainer!, child: button, top: buttonTopInset, bottom: buttonBottomInset)
}
buttonsContainer!.addConstraints(Layout.constraint(horizontalFormat + "|", options: nil, metrics: ["horizontalButtonSpace": horizontalButtonSpace], views: buttonViews))
buttonsContainer!.addConstraints(Layout.constraint(horizontalFormat + "|", options: nil, metrics: ["buttonRightInset": buttonRightInset], views: buttonViews))
}
}
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.11.0</string>
<string>1.12.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -372,8 +372,8 @@ extension MaterialTheme {
// spacing
extension MaterialTheme {
public static var verticalSpace: CGFloat = 8
public static var horizontalSpace: CGFloat = 2 * verticalSpace
public static var verticalInset: CGFloat = 8
public static var horizontalInset: CGFloat = 2 * verticalInset
}
// fonts
......
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