Commit b1e47781 by Daniel Dahan

development: minor tweaks to Card types for code clarity

parent e2709f63
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Material' s.name = 'Material'
s.version = '2.3.15' s.version = '2.3.16'
s.license = 'BSD-3-Clause' s.license = 'BSD-3-Clause'
s.summary = 'Material is an animation and graphics framework that is used to create beautiful applications.' s.summary = 'Material is an animation and graphics framework that is used to create beautiful applications.'
s.homepage = 'http://materialswift.com' s.homepage = 'http://materialswift.com'
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>2.3.15</string> <string>2.3.16</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -209,9 +209,6 @@ open class Card: PulseView { ...@@ -209,9 +209,6 @@ open class Card: PulseView {
container.height = h container.height = h
bounds.size.height = h bounds.size.height = h
container.height = h
bounds.size.height = h
} }
/** /**
...@@ -237,26 +234,22 @@ open class Card: PulseView { ...@@ -237,26 +234,22 @@ open class Card: PulseView {
- Returns: A CGFloat. - Returns: A CGFloat.
*/ */
@discardableResult @discardableResult
open func prepare(view: UIView?, with insets: EdgeInsets, from top: CGFloat) -> CGFloat { open func prepare(view: UIView, with insets: EdgeInsets, from top: CGFloat) -> CGFloat {
guard let v = view else {
return top
}
let t = insets.top + top let t = insets.top + top
v.y = t view.y = t
v.x = insets.left view.x = insets.left
let w = container.width - insets.left - insets.right let w = container.width - insets.left - insets.right
var h = v.height var h = view.height
if 0 == h { if 0 == h {
(v as? UILabel)?.sizeToFit() (view as? UILabel)?.sizeToFit()
h = v.sizeThatFits(CGSize(width: w, height: CGFloat.greatestFiniteMagnitude)).height h = view.sizeThatFits(CGSize(width: w, height: CGFloat.greatestFiniteMagnitude)).height
} }
v.width = w view.width = w
v.height = h view.height = h
return t + h + insets.bottom return t + h + insets.bottom
} }
......
...@@ -87,12 +87,10 @@ open class ImageCard: Card { ...@@ -87,12 +87,10 @@ open class ImageCard: Card {
if let v = contentView { if let v = contentView {
h = prepare(view: v, with: contentViewEdgeInsets, from: h) h = prepare(view: v, with: contentViewEdgeInsets, from: h)
container.sendSubview(toBack: v)
} }
if let v = bottomBar { if let v = bottomBar {
h = prepare(view: v, with: bottomBarEdgeInsets, from: h) h = prepare(view: v, with: bottomBarEdgeInsets, from: h)
container.sendSubview(toBack: v)
} }
container.height = h container.height = h
......
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