Commit 74978847 by Daniel Dahan

minor code cleanup

parent cb070075
......@@ -110,9 +110,10 @@ open class Bar: View {
/// Left side UIViews.
open var leftViews = [UIView]() {
didSet {
for v in oldValue {
v.removeFromSuperview()
oldValue.forEach {
$0.removeFromSuperview()
}
layoutSubviews()
}
}
......@@ -120,9 +121,10 @@ open class Bar: View {
/// Right side UIViews.
open var rightViews = [UIView]() {
didSet {
for v in oldValue {
v.removeFromSuperview()
oldValue.forEach {
$0.removeFromSuperview()
}
layoutSubviews()
}
}
......
......@@ -69,9 +69,11 @@ open class Card: PulseView {
open var toolbar: Toolbar? {
didSet {
oldValue?.removeFromSuperview()
if let v = toolbar {
container.addSubview(v)
}
layoutSubviews()
}
}
......@@ -96,10 +98,12 @@ open class Card: PulseView {
open var contentView: UIView? {
didSet {
oldValue?.removeFromSuperview()
if let v = contentView {
v.clipsToBounds = true
container.addSubview(v)
}
layoutSubviews()
}
}
......@@ -124,9 +128,11 @@ open class Card: PulseView {
open var bottomBar: Bar? {
didSet {
oldValue?.removeFromSuperview()
if let v = bottomBar {
container.addSubview(v)
}
layoutSubviews()
}
}
......
......@@ -207,8 +207,8 @@ open class ChipBar: Bar {
/// Buttons.
open var chipItems = [ChipItem]() {
didSet {
for b in oldValue {
b.removeFromSuperview()
oldValue.forEach {
$0.removeFromSuperview()
}
prepareChipItems()
......
......@@ -227,6 +227,7 @@ open class FABMenu: View {
}
addSubview(v)
v.addTarget(self, action: #selector(handleFABButton(button:)), for: .touchUpInside)
}
}
......
......@@ -157,9 +157,10 @@ public struct Grid {
/// An Array of UIButtons.
public var views = [UIView]() {
didSet {
for v in oldValue {
v.removeFromSuperview()
oldValue.forEach {
$0.removeFromSuperview()
}
reload()
}
}
......
......@@ -62,9 +62,11 @@ open class ImageCard: Card {
open var imageView: UIImageView? {
didSet {
oldValue?.removeFromSuperview()
if let v = imageView {
container.addSubview(v)
}
layoutSubviews()
}
}
......
......@@ -51,10 +51,12 @@ open class PresenterCard: Card {
open var presenterView: UIView? {
didSet {
oldValue?.removeFromSuperview()
if let v = presenterView {
v.clipsToBounds = true
container.addSubview(v)
}
layoutSubviews()
}
}
......
......@@ -212,12 +212,11 @@ open class TabBar: Bar {
@objc
open var tabItems = [TabItem]() {
didSet {
for b in oldValue {
b.removeFromSuperview()
oldValue.forEach {
$0.removeFromSuperview()
}
prepareTabItems()
layoutSubviews()
}
}
......
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