Commit 7d7f9c8f by Daniel Dahan

prepare for release

parent 9243457e
......@@ -99,7 +99,7 @@ class ViewController: UIViewController {
cardView.pulseScale = false
cardView.pulseColor = nil
// Image.
// Image - resize method is located in ContentKit or Examples project.
cardView.image = UIImage(named: "iTunesArtwork")?.resize(toWidth: 400)
cardView.contentsGravity = .BottomRight
......
......@@ -40,8 +40,8 @@ class ViewController: UIViewController {
// Examples of using ImageCardView.
// Uncomment different examples and read
// the comments below.
// prepareGeneralImageCardViewExample()
prepareImageCardViewWithoutDetailLabelAndDividerExample()
prepareGeneralImageCardViewExample()
// prepareImageCardViewWithoutDetailLabelAndDividerExample()
}
/**
......@@ -150,8 +150,7 @@ class ViewController: UIViewController {
btn3.setImage(img3, forState: .Highlighted)
// Add buttons to right side.
imageCardView.rightButtons = [btn1]
imageCardView.rightButtonsInsetsRef.top = imageCardView.contentInsetsRef.top
imageCardView.rightButtons = [btn1, btn2, btn3]
// To support orientation changes, use MaterialLayout.
view.addSubview(imageCardView)
......
Pod::Spec.new do |s|
s.name = 'MK'
s.version = '1.24.9'
s.version = '1.24.10'
s.license = { :type => "AGPL-3.0", :file => "LICENSE" }
s.summary = 'Beautiful Material Design in Swift.'
s.homepage = 'http://materialkit.io'
......
......@@ -32,7 +32,7 @@
96D88C341C1328D800B91418 /* MaterialLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C0B1C1328D800B91418 /* MaterialLayer.swift */; };
96D88C351C1328D800B91418 /* MaterialLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C0C1C1328D800B91418 /* MaterialLayout.swift */; };
96D88C361C1328D800B91418 /* MaterialPulseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C0D1C1328D800B91418 /* MaterialPulseView.swift */; };
96D88C371C1328D800B91418 /* MaterialCornerRadius.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C0E1C1328D800B91418 /* MaterialCornerRadius.swift */; };
96D88C371C1328D800B91418 /* MaterialRadius.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C0E1C1328D800B91418 /* MaterialRadius.swift */; };
96D88C381C1328D800B91418 /* MaterialShape.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C0F1C1328D800B91418 /* MaterialShape.swift */; };
96D88C3A1C1328D800B91418 /* MaterialTextLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C111C1328D800B91418 /* MaterialTextLayer.swift */; };
96D88C3B1C1328D800B91418 /* MaterialTheme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D88C121C1328D800B91418 /* MaterialTheme.swift */; };
......@@ -51,7 +51,7 @@
96D88C561C132ABF00B91418 /* MaterialTheme.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C121C1328D800B91418 /* MaterialTheme.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96D88C571C132ABF00B91418 /* CardView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88BF61C1328D800B91418 /* CardView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96D88C581C132ABF00B91418 /* ImageCardView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88BFB1C1328D800B91418 /* ImageCardView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96D88C5A1C132ABF00B91418 /* MaterialCornerRadius.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C0E1C1328D800B91418 /* MaterialCornerRadius.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96D88C5A1C132ABF00B91418 /* MaterialRadius.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C0E1C1328D800B91418 /* MaterialRadius.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96D88C5B1C132ABF00B91418 /* MaterialShape.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C0F1C1328D800B91418 /* MaterialShape.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96D88C5C1C132ABF00B91418 /* MaterialBorder.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C011C1328D800B91418 /* MaterialBorder.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96D88C5D1C132ABF00B91418 /* MaterialColor.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96D88C031C1328D800B91418 /* MaterialColor.swift */; settings = {ATTRIBUTES = (Public, ); }; };
......@@ -121,7 +121,7 @@
96D88C0B1C1328D800B91418 /* MaterialLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialLayer.swift; sourceTree = "<group>"; };
96D88C0C1C1328D800B91418 /* MaterialLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialLayout.swift; sourceTree = "<group>"; };
96D88C0D1C1328D800B91418 /* MaterialPulseView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialPulseView.swift; sourceTree = "<group>"; };
96D88C0E1C1328D800B91418 /* MaterialCornerRadius.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialCornerRadius.swift; sourceTree = "<group>"; };
96D88C0E1C1328D800B91418 /* MaterialRadius.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialRadius.swift; sourceTree = "<group>"; };
96D88C0F1C1328D800B91418 /* MaterialShape.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialShape.swift; sourceTree = "<group>"; };
96D88C111C1328D800B91418 /* MaterialTextLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTextLayer.swift; sourceTree = "<group>"; };
96D88C121C1328D800B91418 /* MaterialTheme.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialTheme.swift; sourceTree = "<group>"; };
......@@ -243,7 +243,7 @@
96D88C4A1C13294200B91418 /* Type */ = {
isa = PBXGroup;
children = (
96D88C0E1C1328D800B91418 /* MaterialCornerRadius.swift */,
96D88C0E1C1328D800B91418 /* MaterialRadius.swift */,
96D88C0F1C1328D800B91418 /* MaterialShape.swift */,
96D88C011C1328D800B91418 /* MaterialBorder.swift */,
96D88C041C1328D800B91418 /* MaterialDepth.swift */,
......@@ -378,7 +378,7 @@
96D88C561C132ABF00B91418 /* MaterialTheme.swift in Headers */,
96D88C571C132ABF00B91418 /* CardView.swift in Headers */,
96D88C581C132ABF00B91418 /* ImageCardView.swift in Headers */,
96D88C5A1C132ABF00B91418 /* MaterialCornerRadius.swift in Headers */,
96D88C5A1C132ABF00B91418 /* MaterialRadius.swift in Headers */,
96D88C5B1C132ABF00B91418 /* MaterialShape.swift in Headers */,
96D88C5C1C132ABF00B91418 /* MaterialBorder.swift in Headers */,
96D88C5D1C132ABF00B91418 /* MaterialColor.swift in Headers */,
......@@ -500,7 +500,7 @@
96D88C3D1C1328D800B91418 /* MaterialView.swift in Sources */,
96D88C291C1328D800B91418 /* MaterialBasicAnimation.swift in Sources */,
96D88C3A1C1328D800B91418 /* MaterialTextLayer.swift in Sources */,
96D88C371C1328D800B91418 /* MaterialCornerRadius.swift in Sources */,
96D88C371C1328D800B91418 /* MaterialRadius.swift in Sources */,
96D88C241C1328D800B91418 /* ImageCardView.swift in Sources */,
96D88C2B1C1328D800B91418 /* MaterialButton.swift in Sources */,
96D88C311C1328D800B91418 /* MaterialKeyframeAnimation.swift in Sources */,
......
......@@ -261,7 +261,7 @@ cardView.backgroundColor = MaterialColor.red.darken1
cardView.pulseScale = false
cardView.pulseColor = nil
// Image.
// Image - resize method is located in ContentKit or Examples project.
cardView.image = UIImage(named: "iTunesArtwork")?.resize(toWidth: 400)
cardView.contentsGravity = .BottomRight
......@@ -495,7 +495,6 @@ btn3.setImage(img3, forState: .Highlighted)
// Add buttons to right side.
imageCardView.rightButtons = [btn1, btn2, btn3]
imageCardView.rightButtonsInsetsRef.top = imageCardView.contentInsetsRef.top
// To support orientation changes, use MaterialLayout.
view.addSubview(imageCardView)
......
......@@ -381,7 +381,7 @@ public class ImageCardView : MaterialPulseView {
if nil != imageLayer?.contents {
verticalFormat += "-(insetTop)"
metrics["insetTop"] = contentInsetsRef.top + imageLayer!.frame.height
metrics["insetTop"] = imageLayer!.frame.height
} else if nil != titleLabel {
verticalFormat += "-(insetTop)"
metrics["insetTop"] = contentInsetsRef.top + titleLabelInsetsRef.top
......@@ -498,7 +498,7 @@ public class ImageCardView : MaterialPulseView {
if nil == metrics["insetC"] {
metrics["insetBottom"] = contentInsetsRef.bottom + titleLabelInsetsRef.bottom + (divider ? dividerInsetsRef.top + dividerInsetsRef.bottom : 0)
} else {
metrics["insetC"] = (metrics["insetTop"] as! CGFloat) + titleLabelInsetsRef.bottom + (divider ? dividerInsetsRef.top + dividerInsetsRef.bottom : 0)
metrics["insetC"] = (metrics["insetC"] as! CGFloat) + titleLabelInsetsRef.bottom + (divider ? dividerInsetsRef.top + dividerInsetsRef.bottom : 0)
}
} else if nil != metrics["insetC"] {
metrics["insetC"] = (metrics["insetC"] as! CGFloat) + contentInsetsRef.top + (divider ? dividerInsetsRef.top + dividerInsetsRef.bottom : 0)
......@@ -525,13 +525,19 @@ public class ImageCardView : MaterialPulseView {
if 0 < leftButtons?.count {
verticalFormat += "-[button]"
views["button"] = leftButtons![0]
metrics["insetTop"] = (metrics["insetTop"] as! CGFloat) + leftButtonsInsetsRef.top + (divider ? dividerInsetsRef.top + dividerInsetsRef.bottom : 0)
metrics["insetTop"] = (metrics["insetTop"] as! CGFloat) + contentInsetsRef.top + leftButtonsInsetsRef.top + (divider ? dividerInsetsRef.top + dividerInsetsRef.bottom : 0)
metrics["insetBottom"] = contentInsetsRef.bottom + leftButtonsInsetsRef.bottom
} else if 0 < rightButtons?.count {
verticalFormat += "-[button]"
views["button"] = rightButtons![0]
metrics["insetTop"] = (metrics["insetTop"] as! CGFloat) + rightButtonsInsetsRef.top + (divider ? dividerInsetsRef.top + dividerInsetsRef.bottom : 0)
metrics["insetTop"] = (metrics["insetTop"] as! CGFloat) + contentInsetsRef.top + rightButtonsInsetsRef.top + (divider ? dividerInsetsRef.top + dividerInsetsRef.bottom : 0)
metrics["insetBottom"] = contentInsetsRef.bottom + rightButtonsInsetsRef.bottom
} else {
if translatesAutoresizingMaskIntoConstraints {
addConstraints(MaterialLayout.constraint("V:[view(height)]", options: [], metrics: ["height": imageLayer!.frame.height], views: ["view": self]))
} else {
height = imageLayer!.frame.height
}
}
}
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.24.9</string>
<string>1.24.10</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -18,8 +18,6 @@
import UIKit
public typealias MaterialBorderType = CGFloat
public enum MaterialBorder {
case None
case Border1
......@@ -36,7 +34,7 @@ public enum MaterialBorder {
/**
:name: MaterialBorderToValue
*/
public func MaterialBorderToValue(border: MaterialBorder) -> MaterialBorderType {
public func MaterialBorderToValue(border: MaterialBorder) -> CGFloat {
switch border {
case .None:
return 0
......
......@@ -215,10 +215,10 @@ public class MaterialButton : UIButton {
/**
:name: cornerRadius
*/
public var cornerRadius: MaterialCornerRadius? {
public var cornerRadius: MaterialRadius? {
didSet {
if let v: MaterialCornerRadius = cornerRadius {
layer.cornerRadius = MaterialCornerRadiusToValue(v)
if let v: MaterialRadius = cornerRadius {
layer.cornerRadius = MaterialRadiusToValue(v)
if .Circle == shape {
shape = .None
}
......
......@@ -18,8 +18,6 @@
import UIKit
public typealias MaterialGravityType = String
public enum MaterialGravity {
case Center
case Top
......
......@@ -45,39 +45,39 @@ public struct MaterialLayout {
MaterialLayout.height(parent, child: child, height: height)
}
/**
:name: alignChildrenToParentHorizontally
*/
public static func alignChildrenToParentHorizontally(parent: UIView, children: Array<UIView>, left: CGFloat = 0, right: CGFloat = 0, minimumInteritemSpacing: CGFloat = 0, options: NSLayoutFormatOptions = []) {
if 0 < children.count {
var format: String = "H:"
var i: Int = 1
var views: Dictionary<String, UIView> = Dictionary<String, UIView>()
for v in children {
let k: String = "view\(i++)"
views[k] = v
format += i > children.count ? "[\(k)]" : "[\(k)]"
}
print(format)
parent.addConstraints(constraint(format, options: options, metrics: ["left" : left, "right": right, "minimumInteritemSpacing": minimumInteritemSpacing], views: views))
}
}
/**
:name: alignChildrenToParentVertically
*/
public static func alignChildrenToParentVertically(parent: UIView, children: Array<UIView>, top: CGFloat = 0, bottom: CGFloat = 0, minimumLineSpacing: CGFloat = 0, options: NSLayoutFormatOptions = []) {
if 0 < children.count {
var format: String = "V:|-(left)-"
var i: Int = 1
var views: Dictionary<String, UIView> = Dictionary<String, UIView>()
for v in children {
views["view\(i++)"] = v
format += i == children.count ? "[view\(i++)]-(right)-|" : "[view\(i++)]-(>=minimumLineSpacing)-"
}
parent.addConstraints(constraint(format, options: options, metrics: ["top" : top, "bottom": bottom, "minimumLineSpacing": minimumLineSpacing], views: views))
}
}
// /**
// :name: alignChildrenToParentHorizontally
// */
// public static func alignChildrenToParentHorizontally(parent: UIView, children: Array<UIView>, left: CGFloat = 0, right: CGFloat = 0, minimumInteritemSpacing: CGFloat = 0, options: NSLayoutFormatOptions = []) {
// if 0 < children.count {
// var format: String = "H:"
// var i: Int = 1
// var views: Dictionary<String, UIView> = Dictionary<String, UIView>()
// for v in children {
// let k: String = "view\(i++)"
// views[k] = v
// format += i > children.count ? "[\(k)]" : "[\(k)]"
// }
// print(format)
// parent.addConstraints(constraint(format, options: options, metrics: ["left" : left, "right": right, "minimumInteritemSpacing": minimumInteritemSpacing], views: views))
// }
// }
//
// /**
// :name: alignChildrenToParentVertically
// */
// public static func alignChildrenToParentVertically(parent: UIView, children: Array<UIView>, top: CGFloat = 0, bottom: CGFloat = 0, minimumLineSpacing: CGFloat = 0, options: NSLayoutFormatOptions = []) {
// if 0 < children.count {
// var format: String = "V:|-(left)-"
// var i: Int = 1
// var views: Dictionary<String, UIView> = Dictionary<String, UIView>()
// for v in children {
// views["view\(i++)"] = v
// format += i == children.count ? "[view\(i++)]-(right)-|" : "[view\(i++)]-(>=minimumLineSpacing)-"
// }
// parent.addConstraints(constraint(format, options: options, metrics: ["top" : top, "bottom": bottom, "minimumLineSpacing": minimumLineSpacing], views: views))
// }
// }
/**
:name: alignToParentHorizontally
......
......@@ -18,9 +18,7 @@
import UIKit
public typealias MaterialCornerRadiusType = CGFloat
public enum MaterialCornerRadius {
public enum MaterialRadius {
case None
case Radius1
case Radius2
......@@ -29,9 +27,9 @@ public enum MaterialCornerRadius {
}
/**
:name: MaterialCornerRadiusToValue
:name: MaterialRadiusToValue
*/
public func MaterialCornerRadiusToValue(radius: MaterialCornerRadius) -> MaterialCornerRadiusType {
public func MaterialRadiusToValue(radius: MaterialRadius) -> CGFloat {
switch radius {
case .None:
return 0
......
......@@ -265,7 +265,7 @@ public extension MaterialTheme.flatButton {
public static var shadowColor: UIColor = MaterialColor.black
// shape
public static var cornerRadius: MaterialCornerRadius = .Radius1
public static var cornerRadius: MaterialRadius = .Radius1
public static var contentInsets: MaterialEdgeInsets = .WideRectangle3
public static var shape: MaterialShape = .None
......@@ -296,7 +296,7 @@ public extension MaterialTheme.raisedButton {
public static var shadowColor: UIColor = MaterialColor.black
// shape
public static var cornerRadius: MaterialCornerRadius = .Radius1
public static var cornerRadius: MaterialRadius = .Radius1
public static var contentInsets: MaterialEdgeInsets = .WideRectangle2
public static var shape: MaterialShape = .None
......
......@@ -210,10 +210,10 @@ public class MaterialView : UIView {
/**
:name: cornerRadius
*/
public var cornerRadius: MaterialCornerRadius {
public var cornerRadius: MaterialRadius {
didSet {
if let v: MaterialCornerRadius = cornerRadius {
layer.cornerRadius = MaterialCornerRadiusToValue(v)
if let v: MaterialRadius = cornerRadius {
layer.cornerRadius = MaterialRadiusToValue(v)
if .Circle == shape {
shape = .None
}
......
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