Commit b1f97f5c by Daniel Dahan

development: reworking internals for Cards

parent 71b92d5c
...@@ -68,6 +68,7 @@ class ViewController: UIViewController { ...@@ -68,6 +68,7 @@ class ViewController: UIViewController {
dateFormatter.dateStyle = .medium dateFormatter.dateStyle = .medium
dateFormatter.timeStyle = .none dateFormatter.timeStyle = .none
} }
private func prepareDateLabel() { private func prepareDateLabel() {
dateLabel = UILabel() dateLabel = UILabel()
dateLabel.font = RobotoFont.regular(with: 12) dateLabel.font = RobotoFont.regular(with: 12)
......
This image diff could not be displayed because it is too large. You can view the blob instead.
...@@ -32,95 +32,76 @@ import UIKit ...@@ -32,95 +32,76 @@ import UIKit
import Material import Material
class ViewController: UIViewController { class ViewController: UIViewController {
private var card: ImageCard! /// View.
internal var imageCard: ImageCard!
/// Conent area.
private var imageView: UIImageView!
private var contentView: UILabel!
/// Bottom Bar views.
private var bottomBar: Bar!
private var favoriteButton: FlatButton!
private var shareButton: FlatButton!
private var starButton: FlatButton!
/// Toolbar views.
private var toolbar: Toolbar!
private var moreButton: IconButton!
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
view.backgroundColor = Color.grey.lighten5 view.backgroundColor = Color.grey.lighten5
prepareImageView() // Prepare view.
prepareFavoriteButton()
prepareShareButton()
prepareStarButton()
prepareMoreButton()
prepareToolbar()
prepareContentView()
prepareBottomBar()
prepareImageCard() prepareImageCard()
} }
}
private func prepareImageView() { /// ImageCard.
imageView = UIImageView() extension ViewController {
imageView.image = UIImage(named: "frontier.jpg")?.resize(toWidth: view.width) internal func prepareImageCard() {
imageView.contentMode = .scaleAspectFill imageCard = ImageCard()
} view.layout(imageCard).horizontally(left: 20, right: 20).center()
private func prepareFavoriteButton() { prepareToolbar()
favoriteButton = FlatButton(image: Icon.favorite, tintColor: Color.blueGrey.base) prepareImageView()
prepareContentView()
prepareBottomBar()
} }
private func prepareShareButton() { private func prepareToolbar() {
shareButton = FlatButton(image: Icon.cm.share, tintColor: Color.blueGrey.base) imageCard.toolbar = Toolbar()
} imageCard.toolbar?.backgroundColor = .clear
imageCard.toolbarEdgeInsetsPreset = .square3
private func prepareStarButton() { // Use the property subscript to access the model data.
starButton = FlatButton(image: Icon.cm.star, tintColor: Color.blueGrey.base) imageCard.toolbar?.title = "Graph"
} imageCard.toolbar?.titleLabel.textColor = .white
private func prepareMoreButton() { imageCard.toolbar?.detail = "Build Data-Driven Software"
moreButton = IconButton(image: Icon.cm.moreHorizontal, tintColor: .white) imageCard.toolbar?.detailLabel.textColor = .white
} }
private func prepareToolbar() { private func prepareImageView() {
toolbar = Toolbar() imageCard.imageView = UIImageView()
toolbar.backgroundColor = nil imageCard.imageView?.image = UIImage(named: "frontier.jpg")?.resize(toWidth: view.width)
toolbar.title = "CosmicMind"
toolbar.titleLabel.textColor = .white
toolbar.detail = "Build Beautiful Software"
toolbar.detailLabel.textColor = .white
} }
private func prepareContentView() { private func prepareContentView() {
contentView = UILabel() let label = UILabel()
contentView.numberOfLines = 0 label.numberOfLines = 0
contentView.text = "Build beautiful applications that are intelligently driven using Material, Graph, and Algorithm." label.text = "Graph is a semantic database that is used to create data-driven applications."
contentView.font = RobotoFont.regular(with: 14) label.font = RobotoFont.regular(with: 14)
}
private func prepareBottomBar() { imageCard.contentView = label
bottomBar = Bar(centerViews: [favoriteButton, shareButton, starButton]) imageCard.contentViewEdgeInsetsPreset = .square3
} }
private func prepareImageCard() { private func prepareBottomBar() {
card = ImageCard() let shareButton = IconButton(image: Icon.cm.share, tintColor: Color.blueGrey.base)
let favoriteButton = IconButton(image: Icon.favorite, tintColor: Color.red.base)
card.imageView = imageView
let label = UILabel()
card.toolbar = toolbar label.text = "CosmicMind"
card.toolbarEdgeInsetsPreset = .square3 label.textAlignment = .center
label.textColor = Color.blueGrey.base
card.contentView = contentView label.font = RobotoFont.regular(with: 12)
card.contentViewEdgeInsetsPreset = .square3
imageCard.bottomBar = Bar()
card.bottomBar = bottomBar imageCard.bottomBarEdgeInsetsPreset = .wideRectangle2
imageCard.bottomBarEdgeInsets.top = 0
view.layout(card).horizontally(left: 20, right: 20).center() imageCard.bottomBar?.contentViewAlignment = .center
imageCard.bottomBar?.leftViews = [favoriteButton]
imageCard.bottomBar?.centerViews = [label]
imageCard.bottomBar?.rightViews = [shareButton]
} }
} }
...@@ -49,7 +49,7 @@ class ViewController: UIViewController { ...@@ -49,7 +49,7 @@ class ViewController: UIViewController {
layer = Layer(frame: CGRect(x: (w - d) / 2, y: (h - d) / 2, width: d, height: d)) layer = Layer(frame: CGRect(x: (w - d) / 2, y: (h - d) / 2, width: d, height: d))
layer.depthPreset = .depth3 layer.depthPreset = .depth3
layer.shapePreset = .circle layer.shapePreset = .circle
layer.bgColor = .white layer.backgroundColor = Color.white.cgColor
layer.image = UIImage(named: "CosmicMind") layer.image = UIImage(named: "CosmicMind")
view.layer.addSublayer(layer) view.layer.addSublayer(layer)
......
...@@ -55,6 +55,30 @@ class ViewController: UIViewController { ...@@ -55,6 +55,30 @@ class ViewController: UIViewController {
let btn3 = FlatButton(title: "Video", titleColor: Color.blueGrey.base) let btn3 = FlatButton(title: "Video", titleColor: Color.blueGrey.base)
btn3.pulseAnimation = .none btn3.pulseAnimation = .none
buttons.append(btn3) buttons.append(btn3)
let btn4 = FlatButton(title: "Video", titleColor: Color.blueGrey.base)
btn4.pulseAnimation = .none
buttons.append(btn4)
let btn5 = FlatButton(title: "Video 1", titleColor: Color.blueGrey.base)
btn5.pulseAnimation = .none
buttons.append(btn5)
//
// let btn6 = FlatButton(title: "Video 2", titleColor: Color.blueGrey.base)
// btn6.pulseAnimation = .none
// buttons.append(btn6)
//
// let btn7 = FlatButton(title: "Video 3", titleColor: Color.blueGrey.base)
// btn7.pulseAnimation = .none
// buttons.append(btn7)
//
// let btn8 = FlatButton(title: "Video 4", titleColor: Color.blueGrey.base)
// btn8.pulseAnimation = .none
// buttons.append(btn8)
//
// let btn9 = FlatButton(title: "Video 5", titleColor: Color.blueGrey.base)
// btn9.pulseAnimation = .none
// buttons.append(btn9)
} }
private func prepareTabBar() { private func prepareTabBar() {
......
...@@ -125,15 +125,12 @@ open class Bar: View { ...@@ -125,15 +125,12 @@ open class Bar: View {
} }
/// Center UIViews. /// Center UIViews.
open var centerViews: [UIView] { open var centerViews = [UIView]() {
get { didSet {
return contentView.grid.views for v in oldValue {
}
set(value) {
for v in contentView.grid.views {
v.removeFromSuperview() v.removeFromSuperview()
} }
contentView.grid.views = value layoutSubviews()
} }
} }
...@@ -168,12 +165,13 @@ open class Bar: View { ...@@ -168,12 +165,13 @@ open class Bar: View {
- Parameter centerViews: An Array of UIViews that go in the center. - Parameter centerViews: An Array of UIViews that go in the center.
*/ */
public init(leftViews: [UIView]? = nil, rightViews: [UIView]? = nil, centerViews: [UIView]? = nil) { public init(leftViews: [UIView]? = nil, rightViews: [UIView]? = nil, centerViews: [UIView]? = nil) {
super.init(frame: .zero)
self.leftViews = leftViews ?? [] self.leftViews = leftViews ?? []
self.rightViews = rightViews ?? [] self.rightViews = rightViews ?? []
super.init(frame: .zero)
self.centerViews = centerViews ?? [] self.centerViews = centerViews ?? []
frame.size = intrinsicContentSize frame.size = intrinsicContentSize
} }
open override func layoutSubviews() { open override func layoutSubviews() {
super.layoutSubviews() super.layoutSubviews()
guard willLayout else { guard willLayout else {
...@@ -224,6 +222,7 @@ open class Bar: View { ...@@ -224,6 +222,7 @@ open class Bar: View {
} }
contentView.grid.begin() contentView.grid.begin()
contentView.grid.views = centerViews
if .center == contentViewAlignment { if .center == contentViewAlignment {
if lc < rc { if lc < rc {
......
...@@ -79,7 +79,7 @@ open class Button: UIButton { ...@@ -79,7 +79,7 @@ open class Button: UIButton {
@IBInspectable @IBInspectable
open override var backgroundColor: UIColor? { open override var backgroundColor: UIColor? {
didSet { didSet {
layer.bgColor = backgroundColor layer.backgroundColor = backgroundColor?.cgColor
} }
} }
...@@ -192,6 +192,8 @@ open class Button: UIButton { ...@@ -192,6 +192,8 @@ open class Button: UIButton {
} }
Animation.pulseContractAnimation(layer: s.layer, visualLayer: s.visualLayer, pulse: &s.pulse) Animation.pulseContractAnimation(layer: s.layer, visualLayer: s.visualLayer, pulse: &s.pulse)
} }
bringImageViewToFront()
} }
/** /**
...@@ -203,6 +205,8 @@ open class Button: UIButton { ...@@ -203,6 +205,8 @@ open class Button: UIButton {
open override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { open override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event) super.touchesBegan(touches, with: event)
Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, point: layer.convert(touches.first!.location(in: self), from: layer), width: width, height: height, pulse: &pulse) Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, point: layer.convert(touches.first!.location(in: self), from: layer), width: width, height: height, pulse: &pulse)
bringImageViewToFront()
} }
/** /**
...@@ -227,6 +231,14 @@ open class Button: UIButton { ...@@ -227,6 +231,14 @@ open class Button: UIButton {
Animation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulse: &pulse) Animation.pulseContractAnimation(layer: layer, visualLayer: visualLayer, pulse: &pulse)
} }
open func bringImageViewToFront() {
guard let v = imageView else {
return
}
bringSubview(toFront: v)
}
/** /**
Prepares the view instance when intialized. When subclassing, Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepare method it is recommended to override the prepare method
......
...@@ -70,7 +70,7 @@ open class CapturePreview: View { ...@@ -70,7 +70,7 @@ open class CapturePreview: View {
/// Prepares the previewLayer. /// Prepares the previewLayer.
private func preparePreviewLayer() { private func preparePreviewLayer() {
layer.bgColor = .black layer.backgroundColor = Color.black.cgColor
layer.masksToBounds = true layer.masksToBounds = true
(layer as! AVCaptureVideoPreviewLayer).videoGravity = AVLayerVideoGravityResizeAspectFill (layer as! AVCaptureVideoPreviewLayer).videoGravity = AVLayerVideoGravityResizeAspectFill
} }
......
...@@ -178,7 +178,7 @@ open class Card: PulseView { ...@@ -178,7 +178,7 @@ open class Card: PulseView {
/// Reloads the layout. /// Reloads the layout.
open func reload() { open func reload() {
// Clear constraints so new ones do not conflict. // Clear constraints so new ones do not conflict.
container.removeConstraints(constraints) container.removeConstraints(container.constraints)
for v in container.subviews { for v in container.subviews {
v.removeFromSuperview() v.removeFromSuperview()
} }
...@@ -193,9 +193,7 @@ open class Card: PulseView { ...@@ -193,9 +193,7 @@ open class Card: PulseView {
format += "-(toolbarTop)-[toolbar]-(toolbarBottom)" format += "-(toolbarTop)-[toolbar]-(toolbarBottom)"
views["toolbar"] = v views["toolbar"] = v
container.layout(v).horizontally(left: toolbarEdgeInsets.left, right: toolbarEdgeInsets.right).height(v.height) container.layout(v).horizontally(left: toolbarEdgeInsets.left, right: toolbarEdgeInsets.right)
v.grid.reload()
v.divider.reload()
} }
if let v = contentView { if let v = contentView {
...@@ -211,6 +209,7 @@ open class Card: PulseView { ...@@ -211,6 +209,7 @@ open class Card: PulseView {
views["contentView"] = v views["contentView"] = v
container.layout(v).horizontally(left: contentViewEdgeInsets.left, right: contentViewEdgeInsets.right) container.layout(v).horizontally(left: contentViewEdgeInsets.left, right: contentViewEdgeInsets.right)
v.grid.reload() v.grid.reload()
v.divider.reload() v.divider.reload()
} }
...@@ -230,9 +229,7 @@ open class Card: PulseView { ...@@ -230,9 +229,7 @@ open class Card: PulseView {
} }
views["bottomBar"] = v views["bottomBar"] = v
container.layout(v).horizontally(left: bottomBarEdgeInsets.left, right: bottomBarEdgeInsets.right).height(v.height) container.layout(v).horizontally(left: bottomBarEdgeInsets.left, right: bottomBarEdgeInsets.right)
v.grid.reload()
v.divider.reload()
} }
guard 0 < views.count else { guard 0 < views.count else {
......
...@@ -186,7 +186,7 @@ open class CollectionReusableView: UICollectionReusableView { ...@@ -186,7 +186,7 @@ open class CollectionReusableView: UICollectionReusableView {
/// A property that accesses the backing layer's background /// A property that accesses the backing layer's background
@IBInspectable open override var backgroundColor: UIColor? { @IBInspectable open override var backgroundColor: UIColor? {
didSet { didSet {
layer.bgColor = backgroundColor layer.backgroundColor = backgroundColor?.cgColor
} }
} }
......
...@@ -193,7 +193,7 @@ open class CollectionViewCell: UICollectionViewCell { ...@@ -193,7 +193,7 @@ open class CollectionViewCell: UICollectionViewCell {
@IBInspectable @IBInspectable
open override var backgroundColor: UIColor? { open override var backgroundColor: UIColor? {
didSet { didSet {
layer.bgColor = backgroundColor layer.backgroundColor = backgroundColor?.cgColor
} }
} }
......
...@@ -32,31 +32,31 @@ import UIKit ...@@ -32,31 +32,31 @@ import UIKit
public protocol FontType {} public protocol FontType {}
public struct Font: FontType { public struct Font {
/// Size of font. /// Size of font.
public static let pointSize: CGFloat = 16 public static let pointSize: CGFloat = 16
/** /**
Retrieves the system font with a specified size. Retrieves the system font with a specified size.
- Parameter fontName: A String font name. - Parameter ofSize size: A CGFloat.
*/ */
public static func systemFontWithSize(size: CGFloat) -> UIFont { public static func systemFont(ofSize size: CGFloat) -> UIFont {
return UIFont.systemFont(ofSize: size) return UIFont.systemFont(ofSize: size)
} }
/** /**
Retrieves the bold system font with a specified size.. Retrieves the bold system font with a specified size..
- Parameter fontName: A String font name. - Parameter ofSize size: A CGFloat.
*/ */
public static func boldSystemFontWithSize(size: CGFloat) -> UIFont { public static func boldSystemFont(ofSize size: CGFloat) -> UIFont {
return UIFont.boldSystemFont(ofSize: size) return UIFont.boldSystemFont(ofSize: size)
} }
/** /**
Retrieves the italic system font with a specified size. Retrieves the italic system font with a specified size.
- Parameter fontName: A String font name. - Parameter ofSize size: A CGFloat.
*/ */
public static func italicSystemFontWithSize(size: CGFloat) -> UIFont { public static func italicSystemFont(ofSize size: CGFloat) -> UIFont {
return UIFont.italicSystemFont(ofSize: size) return UIFont.italicSystemFont(ofSize: size)
} }
......
...@@ -74,7 +74,7 @@ open class ImageCard: Card { ...@@ -74,7 +74,7 @@ open class ImageCard: Card {
} }
// Clear constraints so new ones do not conflict. // Clear constraints so new ones do not conflict.
container.removeConstraints(constraints) container.removeConstraints(container.constraints)
for v in container.subviews { for v in container.subviews {
v.removeFromSuperview() v.removeFromSuperview()
} }
...@@ -89,18 +89,16 @@ open class ImageCard: Card { ...@@ -89,18 +89,16 @@ open class ImageCard: Card {
format += "-(imageViewTop)-[imageView]-(imageViewBottom)" format += "-(imageViewTop)-[imageView]-(imageViewBottom)"
views["imageView"] = iv views["imageView"] = iv
container.layout(iv).horizontally(left: imageViewEdgeInsets.left, right: imageViewEdgeInsets.right) container.layout(iv).horizontally(left: imageViewEdgeInsets.left, right: imageViewEdgeInsets.right)
iv.grid.reload()
iv.divider.reload() iv.divider.reload()
if let v = toolbar { if let v = toolbar {
iv.layout(v).horizontally(left: toolbarEdgeInsets.left, right: toolbarEdgeInsets.right).height(v.height) iv.layoutIfNeeded()
if .top == toolbarAlignment { container.layout(v)
iv.layout(v).top(toolbarEdgeInsets.top) .horizontally(left: toolbarEdgeInsets.left, right: toolbarEdgeInsets.right)
} else { .top(.top == toolbarAlignment ? toolbarEdgeInsets.top : iv.height - v.height - toolbarEdgeInsets.bottom)
iv.layout(v).bottom(toolbarEdgeInsets.bottom)
}
v.grid.reload()
v.divider.reload()
} }
if let v = contentView { if let v = contentView {
...@@ -110,6 +108,7 @@ open class ImageCard: Card { ...@@ -110,6 +108,7 @@ open class ImageCard: Card {
format += "-[contentView]-(contentViewBottom)" format += "-[contentView]-(contentViewBottom)"
views["contentView"] = v views["contentView"] = v
container.layout(v).horizontally(left: contentViewEdgeInsets.left, right: contentViewEdgeInsets.right) container.layout(v).horizontally(left: contentViewEdgeInsets.left, right: contentViewEdgeInsets.right)
v.grid.reload() v.grid.reload()
v.divider.reload() v.divider.reload()
} }
...@@ -126,9 +125,7 @@ open class ImageCard: Card { ...@@ -126,9 +125,7 @@ open class ImageCard: Card {
} }
views["bottomBar"] = v views["bottomBar"] = v
container.layout(v).horizontally(left: bottomBarEdgeInsets.left, right: bottomBarEdgeInsets.right).height(v.height) container.layout(v).horizontally(left: bottomBarEdgeInsets.left, right: bottomBarEdgeInsets.right)
v.grid.reload()
v.divider.reload()
} }
guard 0 < views.count else { guard 0 < views.count else {
......
...@@ -248,16 +248,6 @@ extension CALayer { ...@@ -248,16 +248,6 @@ extension CALayer {
} }
} }
/// A UIColor reference to the `backgroundColor`.
open var bgColor: UIColor? {
get {
return nil == backgroundColor ? nil : UIColor(cgColor: backgroundColor!)
}
set(value) {
backgroundColor = bgColor?.cgColor
}
}
/** /**
A method that accepts CAAnimation objects and executes them on the A method that accepts CAAnimation objects and executes them on the
view's backing layer. view's backing layer.
......
...@@ -220,6 +220,8 @@ open class NavigationBar: UINavigationBar { ...@@ -220,6 +220,8 @@ open class NavigationBar: UINavigationBar {
} }
item.contentView.grid.begin() item.contentView.grid.begin()
item.contentView.grid.views = item.centerViews
if .center == item.contentViewAlignment { if .center == item.contentViewAlignment {
if lc < rc { if lc < rc {
item.contentView.grid.columns = columns - 2 * rc item.contentView.grid.columns = columns - 2 * rc
......
...@@ -57,6 +57,9 @@ public class NavigationItem: NSObject { ...@@ -57,6 +57,9 @@ public class NavigationItem: NSObject {
/// Left items. /// Left items.
public var leftViews = [UIView]() { public var leftViews = [UIView]() {
didSet { didSet {
for v in oldValue {
v.removeFromSuperview()
}
navigationBar?.layoutSubviews() navigationBar?.layoutSubviews()
} }
} }
...@@ -64,6 +67,9 @@ public class NavigationItem: NSObject { ...@@ -64,6 +67,9 @@ public class NavigationItem: NSObject {
/// Right items. /// Right items.
public var rightViews = [UIView]() { public var rightViews = [UIView]() {
didSet { didSet {
for v in oldValue {
v.removeFromSuperview()
}
navigationBar?.layoutSubviews() navigationBar?.layoutSubviews()
} }
} }
...@@ -71,6 +77,9 @@ public class NavigationItem: NSObject { ...@@ -71,6 +77,9 @@ public class NavigationItem: NSObject {
/// Center items. /// Center items.
public var centerViews = [UIView]() { public var centerViews = [UIView]() {
didSet { didSet {
for v in oldValue {
v.removeFromSuperview()
}
navigationBar?.layoutSubviews() navigationBar?.layoutSubviews()
} }
} }
...@@ -205,13 +214,10 @@ extension UINavigationItem { ...@@ -205,13 +214,10 @@ extension UINavigationItem {
/// Center UIViews. /// Center UIViews.
open var centerViews: [UIView] { open var centerViews: [UIView] {
get { get {
return navigationItem.contentView.grid.views return navigationItem.centerViews
} }
set(value) { set(value) {
for v in navigationItem.contentView.grid.views { navigationItem.centerViews = value
v.removeFromSuperview()
}
navigationItem.contentView.grid.views = value
} }
} }
} }
...@@ -56,7 +56,7 @@ open class PresenterCard: Card { ...@@ -56,7 +56,7 @@ open class PresenterCard: Card {
open override func reload() { open override func reload() {
// Clear constraints so new ones do not conflict. // Clear constraints so new ones do not conflict.
container.removeConstraints(constraints) container.removeConstraints(container.constraints)
for v in container.subviews { for v in container.subviews {
v.removeFromSuperview() v.removeFromSuperview()
} }
...@@ -71,9 +71,7 @@ open class PresenterCard: Card { ...@@ -71,9 +71,7 @@ open class PresenterCard: Card {
format += "-(toolbarTop)-[toolbar]-(toolbarBottom)" format += "-(toolbarTop)-[toolbar]-(toolbarBottom)"
views["toolbar"] = v views["toolbar"] = v
container.layout(v).horizontally(left: toolbarEdgeInsets.left, right: toolbarEdgeInsets.right).height(v.height) container.layout(v).horizontally(left: toolbarEdgeInsets.left, right: toolbarEdgeInsets.right)
v.grid.reload()
v.divider.reload()
} }
if let v = presenterView { if let v = presenterView {
...@@ -89,6 +87,7 @@ open class PresenterCard: Card { ...@@ -89,6 +87,7 @@ open class PresenterCard: Card {
views["presenterView"] = v views["presenterView"] = v
container.layout(v).horizontally(left: presenterViewEdgeInsets.left, right: presenterViewEdgeInsets.right) container.layout(v).horizontally(left: presenterViewEdgeInsets.left, right: presenterViewEdgeInsets.right)
v.grid.reload() v.grid.reload()
v.divider.reload() v.divider.reload()
} }
...@@ -109,6 +108,7 @@ open class PresenterCard: Card { ...@@ -109,6 +108,7 @@ open class PresenterCard: Card {
views["contentView"] = v views["contentView"] = v
container.layout(v).horizontally(left: contentViewEdgeInsets.left, right: contentViewEdgeInsets.right) container.layout(v).horizontally(left: contentViewEdgeInsets.left, right: contentViewEdgeInsets.right)
v.grid.reload() v.grid.reload()
v.divider.reload() v.divider.reload()
} }
...@@ -131,9 +131,7 @@ open class PresenterCard: Card { ...@@ -131,9 +131,7 @@ open class PresenterCard: Card {
} }
views["bottomBar"] = v views["bottomBar"] = v
container.layout(v).horizontally(left: bottomBarEdgeInsets.left, right: bottomBarEdgeInsets.right).height(v.height) container.layout(v).horizontally(left: bottomBarEdgeInsets.left, right: bottomBarEdgeInsets.right)
v.grid.reload()
v.divider.reload()
} }
guard 0 < views.count else { guard 0 < views.count else {
......
...@@ -66,6 +66,8 @@ internal extension Animation { ...@@ -66,6 +66,8 @@ internal extension Animation {
bLayer.addSublayer(pLayer) bLayer.addSublayer(pLayer)
pulse.layers.insert(bLayer, at: 0) pulse.layers.insert(bLayer, at: 0)
visualLayer.addSublayer(bLayer) visualLayer.addSublayer(bLayer)
bLayer.zPosition = 0
pLayer.zPosition = 0
visualLayer.masksToBounds = !(.centerRadialBeyondBounds == pulse.animation || .radialBeyondBounds == pulse.animation) visualLayer.masksToBounds = !(.centerRadialBeyondBounds == pulse.animation || .radialBeyondBounds == pulse.animation)
...@@ -81,7 +83,7 @@ internal extension Animation { ...@@ -81,7 +83,7 @@ internal extension Animation {
} }
pLayer.cornerRadius = n / 2 pLayer.cornerRadius = n / 2
pLayer.bgColor = pulse.color.withAlphaComponent(pulse.opacity) pLayer.backgroundColor = pulse.color.withAlphaComponent(pulse.opacity).cgColor
pLayer.transform = CATransform3DMakeAffineTransform(CGAffineTransform(scaleX: 0, y: 0)) pLayer.transform = CATransform3DMakeAffineTransform(CGAffineTransform(scaleX: 0, y: 0))
}) })
......
...@@ -68,10 +68,12 @@ public struct RobotoFont: FontType { ...@@ -68,10 +68,12 @@ public struct RobotoFont: FontType {
*/ */
public static func thin(with size: CGFloat) -> UIFont { public static func thin(with size: CGFloat) -> UIFont {
Font.loadFontIfNeeded(name: "Roboto-Thin") Font.loadFontIfNeeded(name: "Roboto-Thin")
if let f = UIFont(name: "Roboto-Thin", size: size) { if let f = UIFont(name: "Roboto-Thin", size: size) {
return f return f
} }
return Font.systemFontWithSize(size: size)
return Font.systemFont(ofSize: size)
} }
/** /**
...@@ -81,10 +83,12 @@ public struct RobotoFont: FontType { ...@@ -81,10 +83,12 @@ public struct RobotoFont: FontType {
*/ */
public static func light(with size: CGFloat) -> UIFont { public static func light(with size: CGFloat) -> UIFont {
Font.loadFontIfNeeded(name: "Roboto-Light") Font.loadFontIfNeeded(name: "Roboto-Light")
if let f = UIFont(name: "Roboto-Light", size: size) { if let f = UIFont(name: "Roboto-Light", size: size) {
return f return f
} }
return Font.systemFontWithSize(size: size)
return Font.systemFont(ofSize: size)
} }
/** /**
...@@ -94,10 +98,12 @@ public struct RobotoFont: FontType { ...@@ -94,10 +98,12 @@ public struct RobotoFont: FontType {
*/ */
public static func regular(with size: CGFloat) -> UIFont { public static func regular(with size: CGFloat) -> UIFont {
Font.loadFontIfNeeded(name: "Roboto-Regular") Font.loadFontIfNeeded(name: "Roboto-Regular")
if let f = UIFont(name: "Roboto-Regular", size: size) { if let f = UIFont(name: "Roboto-Regular", size: size) {
return f return f
} }
return Font.systemFontWithSize(size: size)
return Font.systemFont(ofSize: size)
} }
/** /**
...@@ -107,10 +113,12 @@ public struct RobotoFont: FontType { ...@@ -107,10 +113,12 @@ public struct RobotoFont: FontType {
*/ */
public static func medium(with size: CGFloat) -> UIFont { public static func medium(with size: CGFloat) -> UIFont {
Font.loadFontIfNeeded(name: "Roboto-Medium") Font.loadFontIfNeeded(name: "Roboto-Medium")
if let f = UIFont(name: "Roboto-Medium", size: size) { if let f = UIFont(name: "Roboto-Medium", size: size) {
return f return f
} }
return Font.boldSystemFontWithSize(size: size)
return Font.boldSystemFont(ofSize: size)
} }
/** /**
...@@ -120,9 +128,11 @@ public struct RobotoFont: FontType { ...@@ -120,9 +128,11 @@ public struct RobotoFont: FontType {
*/ */
public static func bold(with size: CGFloat) -> UIFont { public static func bold(with size: CGFloat) -> UIFont {
Font.loadFontIfNeeded(name: "Roboto-Bold") Font.loadFontIfNeeded(name: "Roboto-Bold")
if let f = UIFont(name: "Roboto-Bold", size: size) { if let f = UIFont(name: "Roboto-Bold", size: size) {
return f return f
} }
return Font.boldSystemFontWithSize(size: size)
return Font.boldSystemFont(ofSize: size)
} }
} }
...@@ -78,7 +78,7 @@ open class TableViewCell: UITableViewCell { ...@@ -78,7 +78,7 @@ open class TableViewCell: UITableViewCell {
@IBInspectable @IBInspectable
open override var backgroundColor: UIColor? { open override var backgroundColor: UIColor? {
didSet { didSet {
layer.bgColor = backgroundColor layer.backgroundColor = backgroundColor?.cgColor
} }
} }
......
...@@ -38,7 +38,7 @@ public class TextView: UITextView { ...@@ -38,7 +38,7 @@ public class TextView: UITextView {
/// A property that accesses the backing layer's background /// A property that accesses the backing layer's background
@IBInspectable public override var backgroundColor: UIColor? { @IBInspectable public override var backgroundColor: UIColor? {
didSet { didSet {
layer.bgColor = backgroundColor layer.backgroundColor = backgroundColor?.cgColor
} }
} }
......
...@@ -120,7 +120,7 @@ open class View: UIView { ...@@ -120,7 +120,7 @@ open class View: UIView {
@IBInspectable @IBInspectable
open override var backgroundColor: UIColor? { open override var backgroundColor: UIColor? {
didSet { didSet {
layer.bgColor = backgroundColor layer.backgroundColor = backgroundColor?.cgColor
} }
} }
......
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