diff --git a/CardParts/Assets/icons.xcassets/arrowdown.imageset/Contents.json b/CardParts/Assets/icons.xcassets/arrowdown.imageset/Contents.json index 287050d7..454afdc2 100644 --- a/CardParts/Assets/icons.xcassets/arrowdown.imageset/Contents.json +++ b/CardParts/Assets/icons.xcassets/arrowdown.imageset/Contents.json @@ -12,7 +12,6 @@ }, { "idiom" : "universal", - "filename" : "arrowdown@3x.png", "scale" : "3x" } ], diff --git a/CardParts/Assets/icons.xcassets/arrowdown.imageset/arrowdown@3x.png b/CardParts/Assets/icons.xcassets/arrowdown.imageset/arrowdown@3x.png deleted file mode 100644 index 508bf64f..00000000 Binary files a/CardParts/Assets/icons.xcassets/arrowdown.imageset/arrowdown@3x.png and /dev/null differ diff --git a/CardParts/src/Classes/Card Parts/CardPartAttributedTextView.swift b/CardParts/src/Classes/Card Parts/CardPartAttributedTextView.swift index 7181c606..24a581d6 100644 --- a/CardParts/src/Classes/Card Parts/CardPartAttributedTextView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartAttributedTextView.swift @@ -172,7 +172,8 @@ public class CardPartAttributedTextView: UIView, CardPartView { textView.translatesAutoresizingMaskIntoConstraints = false textView.textContainer.lineBreakMode = NSLineBreakMode.byWordWrapping textView.isScrollEnabled = false - textView.textColor = textColor + textView.text = text + textView.backgroundColor = CardParts.theme.attributedTextBackgroundColor textView.isEditable = false self.textView.isSelectable = textView.isSelectable self.isEditable = textView.isEditable @@ -185,6 +186,7 @@ public class CardPartAttributedTextView: UIView, CardPartView { addSubview(textView) setDefaultsForType(type) + setNeedsUpdateConstraints() } required public init?(coder: NSCoder) { diff --git a/CardParts/src/Classes/Card Parts/CardPartBarView.swift b/CardParts/src/Classes/Card Parts/CardPartBarView.swift index 0e5f881d..524d87bb 100644 --- a/CardParts/src/Classes/Card Parts/CardPartBarView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartBarView.swift @@ -22,14 +22,12 @@ public class CardPartBarView: UIView, CardPartView { backgroundLayer = CALayer() backgroundLayer.anchorPoint = .zero - backgroundLayer.backgroundColor = CardParts.theme.barBackgroundColor.cgColor barLayer = CALayer() barLayer.anchorPoint = .zero verticalLine = CALayer() verticalLine.anchorPoint = .zero - verticalLine.backgroundColor = CardParts.theme.todayLineColor.cgColor self.layer.addSublayer(backgroundLayer) self.layer.addSublayer(barLayer) @@ -78,6 +76,9 @@ public class CardPartBarView: UIView, CardPartView { override public var intrinsicContentSize: CGSize { return CGSize(width: UIView.noIntrinsicMetric, height: 18.0) } + public override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + updateBarLayer() + } fileprivate func updateBarLayer() { @@ -85,17 +86,19 @@ public class CardPartBarView: UIView, CardPartView { let bounds = CGRect(x: 0, y: 0, width: CGFloat(percent) * self.bounds.width , height: desiredHeight) barLayer.bounds = bounds - barLayer.backgroundColor = barColor.cgColor + barLayer.backgroundColor = barColor.cgColor(with: traitCollection) if CardParts.theme.roundedCorners { barLayer.cornerRadius = bounds.height / 2 } let backgroundBounds = CGRect(x: 0, y: 0, width: self.bounds.width , height: desiredHeight) backgroundLayer.bounds = backgroundBounds + backgroundLayer.backgroundColor = CardParts.theme.barBackgroundColor.cgColor(with: traitCollection) if CardParts.theme.roundedCorners { backgroundLayer.cornerRadius = bounds.height / 2 } + verticalLine.backgroundColor = CardParts.theme.todayLineColor.cgColor(with: traitCollection) if CardParts.theme.showTodayLine { let verticalLineBounds = CGRect(x: 0, y: 0, width: 1.0 , height: self.bounds.height) verticalLine.bounds = verticalLineBounds diff --git a/CardParts/src/Classes/Card Parts/CardPartCollectionViewCardPartsCell.swift b/CardParts/src/Classes/Card Parts/CardPartCollectionViewCardPartsCell.swift index 0ff0b0c5..f0847344 100644 --- a/CardParts/src/Classes/Card Parts/CardPartCollectionViewCardPartsCell.swift +++ b/CardParts/src/Classes/Card Parts/CardPartCollectionViewCardPartsCell.swift @@ -12,6 +12,12 @@ open class CardPartCollectionViewCardPartsCell : UICollectionViewCell { private var rightTopConstraint: NSLayoutConstraint! private var leftTopConstraint: NSLayoutConstraint! + public var borderColor = UIColor.SystemGray6 { + didSet { + layer.borderColor = borderColor.cgColor + } + } + private var cardParts:[CardPartView] = [] override public init(frame: CGRect) { @@ -28,6 +34,10 @@ open class CardPartCollectionViewCardPartsCell : UICollectionViewCell { public required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } + + public override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + layer.borderColor = borderColor.cgColor(with: traitCollection) + } public func setupCardParts(_ cardParts:[CardPartView]) { diff --git a/CardParts/src/Classes/Card Parts/CardPartConfettiView.swift b/CardParts/src/Classes/Card Parts/CardPartConfettiView.swift index b17d9853..22bfaa0f 100644 --- a/CardParts/src/Classes/Card Parts/CardPartConfettiView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartConfettiView.swift @@ -27,7 +27,7 @@ public enum ConfettiType { public class CardPartConfettiView: UIView, CardPartView { public var margins: UIEdgeInsets = CardParts.theme.cardPartMargins - public var colors:[UIColor] = [ UIColor.red, UIColor.green, UIColor.blue ] + public var colors:[UIColor] = [ UIColor.SystemRed, UIColor.SystemGreen, UIColor.SystemBlue ] public var type:ConfettiType = .star /// default : 0.5 value ranges from 0 - 1(being very slow) public var intensity:Float = 0.5 diff --git a/CardParts/src/Classes/Card Parts/CardPartPagedView.swift b/CardParts/src/Classes/Card Parts/CardPartPagedView.swift index 3a6e6640..f1522d5b 100644 --- a/CardParts/src/Classes/Card Parts/CardPartPagedView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartPagedView.swift @@ -52,8 +52,8 @@ public class CardPartPagedView: UIView, CardPartView { pageControl = UIPageControl(frame: .zero) pageControl.translatesAutoresizingMaskIntoConstraints = false - pageControl.pageIndicatorTintColor = UIColor.lightGray - pageControl.currentPageIndicatorTintColor = UIColor.darkGray + pageControl.pageIndicatorTintColor = UIColor.SystemFill + pageControl.currentPageIndicatorTintColor = UIColor.SystemGray currentPage = 0 diff --git a/CardParts/src/Classes/Card Parts/CardPartProgressBarView.swift b/CardParts/src/Classes/Card Parts/CardPartProgressBarView.swift index 58c1a5d9..4de30758 100644 --- a/CardParts/src/Classes/Card Parts/CardPartProgressBarView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartProgressBarView.swift @@ -170,18 +170,16 @@ public class CardPartProgressBarView: UIView, CardPartView { } } - public var bgColor: UIColor = UIColor.white { + public var bgColor: UIColor = .clear { didSet { addMarker(marker: customMarker) layoutSubviews() } } - public var markerColor: UIColor? = UIColor.Black { + public var markerColor: UIColor = UIColor.Label { didSet { - if markerColor != nil { - layout() - } + layout() } } @@ -315,14 +313,12 @@ public class CardPartProgressBarView: UIView, CardPartView { fileprivate func addMarker(marker: UIView?) { - let color: UIColor = UIColor.black - if let marker = marker { self.markerView.addSubview(marker) } else { let triangleView = CardPartTriangleView(frame: CGRect(x: 0, y: 0, width: markerHeight, height: markerHeight)) - triangleView.fillColor = color - triangleView.backgroundColor = .white + triangleView.fillColor = markerColor + triangleView.backgroundColor = bgColor self.markerView.addSubview(triangleView) } layoutSubviews() diff --git a/CardParts/src/Classes/Card Parts/CardPartRadioButton.swift b/CardParts/src/Classes/Card Parts/CardPartRadioButton.swift index 6696184c..7e5f7562 100644 --- a/CardParts/src/Classes/Card Parts/CardPartRadioButton.swift +++ b/CardParts/src/Classes/Card Parts/CardPartRadioButton.swift @@ -17,13 +17,13 @@ public class CardPartRadioButton: UIButton, CardPartView { var outerCircleLayer = CAShapeLayer() var innerCircleLayer = CAShapeLayer() - public var outerCircleColor:UIColor = .blue { + public var outerCircleColor:UIColor = .SystemBlue { didSet{ - outerCircleLayer.strokeColor = outerCircleColor.cgColor + outerCircleLayer.strokeColor = outerCircleColor.cgColor(with: traitCollection) } } - public var innerCircleColor:UIColor = .blue { + public var innerCircleColor:UIColor = .SystemBlue { didSet { setFillState() } @@ -85,10 +85,15 @@ public class CardPartRadioButton: UIButton, CardPartView { super.layoutSubviews() setCircleLayouts() } + + public override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + outerCircleLayer.strokeColor = outerCircleColor.cgColor(with: traitCollection) + setFillState() + } /// fills the color inside the button based the selected state. private func setFillState() { - innerCircleLayer.fillColor = self.isSelected ? outerCircleColor.cgColor : UIColor.clear.cgColor + innerCircleLayer.fillColor = self.isSelected ? outerCircleColor.cgColor(with: traitCollection) : UIColor.clear.cgColor } /// configures outer/inner circle frame,line widt and path diff --git a/CardParts/src/Classes/Card Parts/CardPartTableView.swift b/CardParts/src/Classes/Card Parts/CardPartTableView.swift index b97bad8b..8627e191 100644 --- a/CardParts/src/Classes/Card Parts/CardPartTableView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartTableView.swift @@ -56,7 +56,7 @@ public class CardPartTableView : UIView, CardPartView, UITableViewDelegate { tableView.translatesAutoresizingMaskIntoConstraints = false tableView.register(CardPartTableViewCell.self, forCellReuseIdentifier: kDefaultCellId) tableView.isScrollEnabled = false - tableView.separatorColor = UIColor.turboSeperatorColor + tableView.separatorColor = CardParts.theme.separatorColor tableView.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.size.width, height: 1)) super.init(frame: CGRect.zero) diff --git a/CardParts/src/Classes/Card Parts/CardPartTableViewCell.swift b/CardParts/src/Classes/Card Parts/CardPartTableViewCell.swift index f695eb91..15c2d1ee 100644 --- a/CardParts/src/Classes/Card Parts/CardPartTableViewCell.swift +++ b/CardParts/src/Classes/Card Parts/CardPartTableViewCell.swift @@ -65,17 +65,17 @@ public class CardPartTableViewCell : UITableViewCell { public var displayAsHidden: Bool = false { didSet { - leftTitleLabel.textColor = displayAsHidden ? UIColor.Gray2 : leftTitleColor - rightTitleLabel.textColor = displayAsHidden ? UIColor.Gray2 : rightTitleColor - leftDescriptionLabel.textColor = displayAsHidden ? UIColor.Gray2 : leftDescriptionColor - rightDescriptionLabel.textColor = displayAsHidden ? UIColor.Gray2 : rightDescriptionColor + leftTitleLabel.textColor = displayAsHidden ? UIColor.SystemGray2 : leftTitleColor + rightTitleLabel.textColor = displayAsHidden ? UIColor.SystemGray2 : rightTitleColor + leftDescriptionLabel.textColor = displayAsHidden ? UIColor.SystemGray2 : leftDescriptionColor + rightDescriptionLabel.textColor = displayAsHidden ? UIColor.SystemGray2 : rightDescriptionColor leftTitleLabel.alpha = displayAsHidden ? 0.6 : 1.0 rightTitleLabel.alpha = displayAsHidden ? 0.6 : 1.0 leftDescriptionLabel.alpha = displayAsHidden ? 0.6 : 1.0 rightDescriptionLabel.alpha = displayAsHidden ? 0.6 : 1.0 - backgroundColor = displayAsHidden ? UIColor.Gray6 : UIColor.white + backgroundColor = displayAsHidden ? UIColor.SystemGray6 : CardParts.theme.cardBackgroundColor } } @@ -121,6 +121,7 @@ public class CardPartTableViewCell : UITableViewCell { separatorInset = UIEdgeInsets.init(top: 0, left: 0, bottom: 0, right: 0) + backgroundColor = CardParts.theme.cardBackgroundColor for subview in contentView.subviews { subview.removeFromSuperview() diff --git a/CardParts/src/Classes/Card Parts/CardPartTriangleView.swift b/CardParts/src/Classes/Card Parts/CardPartTriangleView.swift index 08ef96d7..92fbad14 100644 --- a/CardParts/src/Classes/Card Parts/CardPartTriangleView.swift +++ b/CardParts/src/Classes/Card Parts/CardPartTriangleView.swift @@ -11,7 +11,7 @@ class CardPartTriangleView: UIView,CardPartView { var margins: UIEdgeInsets = CardParts.theme.cardPartMargins - var fillColor: UIColor = UIColor.white + var fillColor: UIColor = .Label override init(frame: CGRect) { super.init(frame: frame) diff --git a/CardParts/src/Classes/CardCell.swift b/CardParts/src/Classes/CardCell.swift index f1f5dcda..3a32ee24 100644 --- a/CardParts/src/Classes/CardCell.swift +++ b/CardParts/src/Classes/CardCell.swift @@ -16,6 +16,17 @@ open class CardCell : UICollectionViewCell { private var currentSize = CGSize.zero private var gradientLayer = CAGradientLayer() + + private var borderColor = CardParts.theme.cardBorderColor { + didSet { + contentView.layer.borderColor = borderColor.cgColor(with: traitCollection) + } + } + private var shadowColor = CardParts.theme.cardShadowColor { + didSet { + contentView.layer.shadowColor = shadowColor.cgColor(with: traitCollection) + } + } override init(frame: CGRect) { @@ -26,18 +37,17 @@ open class CardCell : UICollectionViewCell { contentView.translatesAutoresizingMaskIntoConstraints = false - contentView.backgroundColor = UIColor.white - contentView.layer.borderColor = UIColor.Gray7.cgColor + contentView.backgroundColor = CardParts.theme.cardBackgroundColor + contentView.layer.borderColor = borderColor.cgColor(with: traitCollection) contentView.layer.borderWidth = 0.5 if CardParts.theme.cardShadow { - contentView.layer.shadowColor = UIColor.Gray7.cgColor + contentView.layer.shadowColor = shadowColor.cgColor(with: traitCollection) contentView.layer.shadowOffset = CGSize(width: 0, height: 1) contentView.layer.shadowRadius = 1.0 contentView.layer.shadowOpacity = 0.9 } contentView.addSubview(cardContentView) - contentView.backgroundColor = UIColor.white contentView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|[cardContentView]|", options: [], @@ -111,6 +121,11 @@ open class CardCell : UICollectionViewCell { return layoutAttributes } + open override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { + contentView.layer.borderColor = borderColor.cgColor(with: traitCollection) + contentView.layer.shadowColor = shadowColor.cgColor(with: traitCollection) + } + func requiresNoTopBottomMargins(_ noTopBottomMargins: Bool) { contentView.removeConstraints(topBottomMarginConstraints) @@ -135,18 +150,18 @@ open class CardCell : UICollectionViewCell { func requiresTransparentCard(transparentCard: Bool) { if transparentCard { contentView.backgroundColor = UIColor.clear - contentView.layer.borderColor = UIColor.clear.cgColor + self.borderColor = UIColor.clear contentView.layer.borderWidth = 0.0 - contentView.layer.shadowColor = UIColor.clear.cgColor + self.shadowColor = UIColor.clear contentView.layer.shadowOffset = CGSize.zero contentView.layer.shadowRadius = 0.0 contentView.layer.shadowOpacity = 0.0 } else { - contentView.backgroundColor = UIColor.white - contentView.layer.borderColor = UIColor.Gray7.cgColor + contentView.backgroundColor = CardParts.theme.cardBackgroundColor + contentView.layer.borderColor = borderColor.cgColor(with: traitCollection) contentView.layer.borderWidth = 0.5 if CardParts.theme.cardShadow { - contentView.layer.shadowColor = UIColor.Gray7.cgColor + contentView.layer.shadowColor = shadowColor.cgColor(with: traitCollection) contentView.layer.shadowOffset = CGSize(width: 0, height: 1) contentView.layer.shadowRadius = 1.0 contentView.layer.shadowOpacity = 0.9 @@ -154,8 +169,8 @@ open class CardCell : UICollectionViewCell { } } - func addShadowToCard(shadowRadius: CGFloat = 8.0, shadowOpacity: Float = 0.7, shadowColor: CGColor = UIColor.Gray2.cgColor, shadowOffset: CGSize = CGSize(width: 0, height: 5)) { - contentView.layer.shadowColor = shadowColor + func addShadowToCard(shadowRadius: CGFloat = 8.0, shadowOpacity: Float = 0.7, shadowColor: UIColor = UIColor.Gray2, shadowOffset: CGSize = CGSize(width: 0, height: 5)) { + self.shadowColor = shadowColor contentView.layer.shadowOffset = shadowOffset contentView.layer.shadowRadius = shadowRadius contentView.layer.shadowOpacity = shadowOpacity @@ -166,9 +181,9 @@ open class CardCell : UICollectionViewCell { gradientLayer.cornerRadius = radius } - func addBorderToCard(borderWidth: CGFloat = 0.5, borderColor: CGColor = UIColor.Gray7.cgColor) { + func addBorderToCard(borderWidth: CGFloat = 0.5, borderColor: UIColor = UIColor.SystemGray6) { + self.borderColor = borderColor contentView.layer.borderWidth = borderWidth - contentView.layer.borderColor = borderColor } func addLongGestureRecognizer(minimumPressDuration: CFTimeInterval, delegate: CardPartsLongPressGestureRecognizerDelegate) { diff --git a/CardParts/src/Classes/CardController.swift b/CardParts/src/Classes/CardController.swift index 80e0fb77..b006b7d4 100644 --- a/CardParts/src/Classes/CardController.swift +++ b/CardParts/src/Classes/CardController.swift @@ -62,15 +62,15 @@ public protocol HiddenCardTrait { } public protocol ShadowCardTrait { - func shadowColor() -> CGColor + func shadowColor() -> UIColor func shadowRadius() -> CGFloat func shadowOpacity() -> Float func shadowOffset() -> CGSize } extension ShadowCardTrait { - func shadowColor() -> CGColor { - return UIColor.Gray2.cgColor + func shadowColor() -> UIColor { + return UIColor.Gray2 } func shadowRadius() -> CGFloat { @@ -111,7 +111,7 @@ extension CardPartsLongPressGestureRecognizerDelegate { public protocol BorderCardTrait { func borderWidth() -> CGFloat - func borderColor() -> CGColor + func borderColor() -> UIColor } extension BorderCardTrait { @@ -120,8 +120,8 @@ extension BorderCardTrait { return 0.5 } - func borderColor() -> CGColor { - return UIColor.Gray7.cgColor + func borderColor() -> UIColor { + return UIColor.Gray7 } } diff --git a/CardParts/src/Classes/CardParts.swift b/CardParts/src/Classes/CardParts.swift index 05ec0b75..c5712e94 100644 --- a/CardParts/src/Classes/CardParts.swift +++ b/CardParts/src/Classes/CardParts.swift @@ -8,5 +8,5 @@ import Foundation public class CardParts { - public static var theme: CardPartsTheme = CardPartsTurboTheme() + public static var theme: CardPartsTheme = CardPartsSystemTheme() } diff --git a/CardParts/src/Classes/CardPartsFullScreenViewController.swift b/CardParts/src/Classes/CardPartsFullScreenViewController.swift index 48c88cf0..3def93ff 100644 --- a/CardParts/src/Classes/CardPartsFullScreenViewController.swift +++ b/CardParts/src/Classes/CardPartsFullScreenViewController.swift @@ -13,7 +13,7 @@ open class CardPartsFullScreenViewController: CardPartsViewController { open override func viewDidLoad() { super.viewDidLoad() - view.backgroundColor = UIColor.white + view.backgroundColor = CardParts.theme.backgroundColor } } diff --git a/CardParts/src/Classes/CardPartsTheme.swift b/CardParts/src/Classes/CardPartsTheme.swift index 57b832d2..843bb6f0 100644 --- a/CardParts/src/Classes/CardPartsTheme.swift +++ b/CardParts/src/Classes/CardPartsTheme.swift @@ -9,12 +9,18 @@ import Foundation public protocol CardPartsTheme { + var backgroundColor: UIColor { get set } + var cardsViewContentInsetTop: CGFloat { get set } var cardsLineSpacing: CGFloat { get set } - + + // CardCell var cardShadow: Bool { get set } var cardCellMargins: UIEdgeInsets { get set } var cardPartMargins: UIEdgeInsets { get set } + var cardBackgroundColor: UIColor { get set } + var cardBorderColor: UIColor { get set } + var cardShadowColor: UIColor { get set } // CardPartSeparatorView and CardPartVerticalSeparatorView var separatorColor: UIColor { get set } @@ -33,6 +39,7 @@ public protocol CardPartsTheme { var detailTextColor: UIColor { get set } // CardPartAttributedTextView + var attributedTextBackgroundColor: UIColor { get set } var smallAttributedTextFont: UIFont { get set } var smallAttributedTextColor: UIColor { get set } var normalAttributedTextFont: UIFont { get set } @@ -84,7 +91,9 @@ extension CardPartsTheme { } } -public class CardPartsMintTheme: CardPartsTheme { +public class CardPartsSystemTheme: CardPartsTheme { + + public var backgroundColor: UIColor = .SystemGroupedBackground public var cardsViewContentInsetTop: CGFloat = 0.0 public var cardsLineSpacing: CGFloat = 12 @@ -93,48 +102,54 @@ public class CardPartsMintTheme: CardPartsTheme { public var cardCellMargins: UIEdgeInsets = UIEdgeInsets(top: 9.0, left: 12.0, bottom: 12.0, right: 12.0) public var cardPartMargins: UIEdgeInsets = UIEdgeInsets(top: 5.0, left: 15.0, bottom: 5.0, right: 15.0) + // CardCell + public var cardBackgroundColor: UIColor = .SecondarySystemGroupedBackground + public var cardBorderColor: UIColor = .SystemGray6 + public var cardShadowColor: UIColor = .SystemGray6 + // CardPartSeparatorView public var separatorColor: UIColor = UIColor.color(221, green: 221, blue: 221) public var horizontalSeparatorMargins: UIEdgeInsets = UIEdgeInsets(top: 5.0, left: 15.0, bottom: 5.0, right: 15.0) // CardPartTextView - public var smallTextFont: UIFont = UIFont(name: "HelveticaNeue", size: CGFloat(10))! - public var smallTextColor: UIColor = UIColor.color(136, green: 136, blue: 136) - public var normalTextFont: UIFont = UIFont(name: "HelveticaNeue", size: CGFloat(14))! - public var normalTextColor: UIColor = UIColor.color(136, green: 136, blue: 136) - public var titleTextFont: UIFont = UIFont(name: "HelveticaNeue-Medium", size: CGFloat(16))! - public var titleTextColor: UIColor = UIColor.color(17, green: 17, blue: 17) - public var headerTextFont: UIFont = UIFont.turboGenericFontBlack(.header) - public var headerTextColor: UIColor = UIColor.turboCardPartTitleColor - public var detailTextFont: UIFont = UIFont(name: "HelveticaNeue", size: CGFloat(12))! - public var detailTextColor: UIColor = UIColor.color(136, green: 136, blue: 136) + public var smallTextFont: UIFont = .systemFont(ofSize: 10.0) + public var smallTextColor: UIColor = .TertiaryLabel + public var normalTextFont: UIFont = .systemFont(ofSize: 14.0) + public var normalTextColor: UIColor = .TertiaryLabel + public var titleTextFont: UIFont = .systemFont(ofSize: 16, weight: .medium) + public var titleTextColor: UIColor = .Label + public var headerTextFont: UIFont = .systemFont(ofSize: CGFloat(FontSize.header.rawValue), weight: .black) + public var headerTextColor: UIColor = .Label + public var detailTextFont: UIFont = .systemFont(ofSize: 12.0) + public var detailTextColor: UIColor = .TertiaryLabel // CardPartAttributedTextView - public var smallAttributedTextFont: UIFont = UIFont(name: "HelveticaNeue", size: CGFloat(10))! - public var smallAttributedTextColor: UIColor = UIColor.color(136, green: 136, blue: 136) - public var normalAttributedTextFont: UIFont = UIFont(name: "HelveticaNeue", size: CGFloat(12))! - public var normalAttributedTextColor: UIColor = UIColor.color(136, green: 136, blue: 136) - public var titleAttributedTextFont: UIFont = UIFont(name: "HelveticaNeue-Medium", size: CGFloat(16))! - public var titleAttributedTextColor: UIColor = UIColor.color(17, green: 17, blue: 17) - public var headerAttributedTextFont: UIFont = UIFont.turboGenericFontBlack(.header) - public var headerAttributedTextColor: UIColor = UIColor.turboCardPartTitleColor - public var detailAttributedTextFont: UIFont = UIFont(name: "HelveticaNeue", size: CGFloat(12))! - public var detailAttributedTextColor: UIColor = UIColor.color(136, green: 136, blue: 136) + public var smallAttributedTextFont: UIFont = .systemFont(ofSize: 10.0) + public var smallAttributedTextColor: UIColor = .TertiaryLabel + public var normalAttributedTextFont: UIFont = .systemFont(ofSize: 14.0) + public var normalAttributedTextColor: UIColor = .Label + public var titleAttributedTextFont: UIFont = .systemFont(ofSize: 16, weight: .medium) + public var titleAttributedTextColor: UIColor = .Label + public var headerAttributedTextFont: UIFont = .systemFont(ofSize: CGFloat(FontSize.header.rawValue), weight: .black) + public var headerAttributedTextColor: UIColor = .Label + public var detailAttributedTextFont: UIFont = .systemFont(ofSize: 12.0) + public var detailAttributedTextColor: UIColor = .TertiaryLabel + public var attributedTextBackgroundColor: UIColor = .SecondarySystemGroupedBackground // CardPartTitleView - public var titleFont: UIFont = UIFont(name: "HelveticaNeue-Medium", size: CGFloat(16))! - public var titleColor: UIColor = UIColor.color(17, green: 17, blue: 17) + public var titleFont: UIFont = .systemFont(ofSize: 16, weight: .medium) + public var titleColor: UIColor = .Label public var titleViewMargins: UIEdgeInsets = UIEdgeInsets(top: 5.0, left: 15.0, bottom: 10.0, right: 15.0) // CardPartButtonView - public var buttonTitleFont: UIFont = UIFont(name: "HelveticaNeue", size: CGFloat(17))! - public var buttonTitleColor: UIColor = UIColor(red: 69.0/255.0, green: 202.0/255.0, blue: 230.0/255.0, alpha: 1.0) + public var buttonTitleFont: UIFont = .systemFont(ofSize: 17) + public var buttonTitleColor: UIColor = .SystemBlue public var buttonCornerRadius: CGFloat = CGFloat(0.0) // CardPartBarView - public var barBackgroundColor: UIColor = UIColor(red: 221.0/255.0, green: 221.0/255.0, blue: 221.0/255.0, alpha: 1.0) - public var barColor: UIColor = UIColor.turboHeaderBlueColor - public var todayLineColor: UIColor = UIColor.Gray8 + public var barBackgroundColor: UIColor = .TertiarySystemFill + public var barColor: UIColor = .SystemTeal + public var todayLineColor: UIColor = .SystemGray2 public var barHeight: CGFloat = 13.5 public var roundedCorners: Bool = false public var showTodayLine: Bool = true @@ -143,14 +158,14 @@ public class CardPartsMintTheme: CardPartsTheme { public var tableViewMargins: UIEdgeInsets = UIEdgeInsets(top: 0.0, left: 14.0, bottom: 0.0, right: 14.0) // CardPartTableViewCell and CardPartTitleDescriptionView - public var leftTitleFont: UIFont = UIFont(name: "HelveticaNeue", size: CGFloat(17))! - public var leftDescriptionFont: UIFont = UIFont(name: "HelveticaNeue", size: CGFloat(12))! - public var rightTitleFont: UIFont = UIFont(name: "HelveticaNeue", size: CGFloat(17))! - public var rightDescriptionFont: UIFont = UIFont(name: "HelveticaNeue", size: CGFloat(12))! - public var leftTitleColor: UIColor = UIColor.color(17, green: 17, blue: 17) - public var leftDescriptionColor: UIColor = UIColor.color(169, green: 169, blue: 169) - public var rightTitleColor: UIColor = UIColor.color(17, green: 17, blue: 17) - public var rightDescriptionColor: UIColor = UIColor.color(169, green: 169, blue: 169) + public var leftTitleFont: UIFont = .systemFont(ofSize: 17.0) + public var leftDescriptionFont: UIFont = .systemFont(ofSize: 12.0) + public var rightTitleFont: UIFont = .systemFont(ofSize: 17.0) + public var rightDescriptionFont: UIFont = .systemFont(ofSize: 12.0) + public var leftTitleColor: UIColor = .Label + public var leftDescriptionColor: UIColor = .SecondaryLabel + public var rightTitleColor: UIColor = .Label + public var rightDescriptionColor: UIColor = .SecondaryLabel public var secondaryTitlePosition : CardPartSecondaryTitleDescPosition = .right public init() { @@ -158,79 +173,84 @@ public class CardPartsMintTheme: CardPartsTheme { } } - -public class CardPartsTurboTheme: CardPartsTheme { - +public class CardPartsCustomTheme: CardPartsTheme { + + public var backgroundColor: UIColor = UIColor.dynamicColor(light: .Gray6, dark: UIColor.colorFromHex(0x000013)) + public var cardsViewContentInsetTop: CGFloat = 0.0 public var cardsLineSpacing: CGFloat = 12 - + public var cardShadow: Bool = false - public var cardCellMargins: UIEdgeInsets = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: 0.0) + public var cardCellMargins: UIEdgeInsets = UIEdgeInsets(top: 12.0, left: 0.0, bottom: 12.0, right: 0.0) public var cardPartMargins: UIEdgeInsets = UIEdgeInsets(top: 5.0, left: 28.0, bottom: 5.0, right: 28.0) - + + // CardCell + public var cardBackgroundColor: UIColor = UIColor.dynamicColor(light: UIColor.colorFromHex(0xfefffe), dark: UIColor.colorFromHex(0x0A172C)) + public var cardBorderColor: UIColor = .SystemGray6 + public var cardShadowColor: UIColor = .SystemGray6 + // CardPartSeparatorView - public var separatorColor: UIColor = UIColor.turboSeperatorColor + public var separatorColor: UIColor = .cardPartSeparatorColor public var horizontalSeparatorMargins: UIEdgeInsets = UIEdgeInsets(top: 5.0, left: 0.0, bottom: 5.0, right: 0.0) - + // CardPartTextView - public var smallTextFont: UIFont = UIFont.turboGenericFont(.x_Small) - public var smallTextColor: UIColor = UIColor.turboCardPartTextColor - public var normalTextFont: UIFont = UIFont.turboGenericFont(.normal) - public var normalTextColor: UIColor = UIColor.turboCardPartTextColor - public var titleTextFont: UIFont = UIFont.turboGenericMediumFont(.medium) - public var titleTextColor: UIColor = UIColor.turboCardPartTitleColor - public var headerTextFont: UIFont = UIFont.turboGenericFontBlack(.header) - public var headerTextColor: UIColor = UIColor.turboCardPartTitleColor - public var detailTextFont: UIFont = UIFont.turboGenericFont(.small) - public var detailTextColor: UIColor = UIColor.turboCardPartTextColor + public var smallTextFont: UIFont = .cardPartsFont(.x_Small) + public var smallTextColor: UIColor = .cardPartTextColor + public var normalTextFont: UIFont = .cardPartsFont(.normal) + public var normalTextColor: UIColor = .cardPartTextColor + public var titleTextFont: UIFont = .cardPartsMediumFont(.medium) + public var titleTextColor: UIColor = .cardPartTitleColor + public var headerTextFont: UIFont = .cardPartsFontBlack(.header) + public var headerTextColor: UIColor = .cardPartTitleColor + public var detailTextFont: UIFont = .cardPartsFont(.small) + public var detailTextColor: UIColor = .cardPartGrayTextColor // CardPartAttributedTextView - public var smallAttributedTextFont: UIFont = UIFont.turboGenericFont(.x_Small) - public var smallAttributedTextColor: UIColor = UIColor.turboCardPartTextColor - public var normalAttributedTextFont: UIFont = UIFont.turboGenericFont(.normal) - public var normalAttributedTextColor: UIColor = UIColor.turboCardPartTextColor - public var titleAttributedTextFont: UIFont = UIFont.turboGenericMediumFont(.medium) - public var titleAttributedTextColor: UIColor = UIColor.turboCardPartTitleColor - public var headerAttributedTextFont: UIFont = UIFont.turboGenericFontBlack(.header) - public var headerAttributedTextColor: UIColor = UIColor.turboCardPartTitleColor - public var detailAttributedTextFont: UIFont = UIFont.turboGenericFont(.small) - public var detailAttributedTextColor: UIColor = UIColor.turboCardPartTextColor + public var smallAttributedTextFont: UIFont = .cardPartsFont(.x_Small) + public var smallAttributedTextColor: UIColor = .cardPartTextColor + public var normalAttributedTextFont: UIFont = .cardPartsFont(.normal) + public var normalAttributedTextColor: UIColor = .cardPartTextColor + public var titleAttributedTextFont: UIFont = .cardPartsMediumFont(.medium) + public var titleAttributedTextColor: UIColor = .cardPartTitleColor + public var headerAttributedTextFont: UIFont = .cardPartsFontBlack(.header) + public var headerAttributedTextColor: UIColor = .cardPartTitleColor + public var detailAttributedTextFont: UIFont = .cardPartsFont(.small) + public var detailAttributedTextColor: UIColor = .cardPartGrayTextColor + public var attributedTextBackgroundColor: UIColor = UIColor.dynamicColor(light: UIColor.colorFromHex(0xfefffe), dark: UIColor.colorFromHex(0x0A172C)) // CardPartTitleView - public var titleFont: UIFont = UIFont.turboGenericMediumFont(.medium) - public var titleColor: UIColor = UIColor.turboCardPartTitleColor + public var titleFont: UIFont = .cardPartsMediumFont(.medium) + public var titleColor: UIColor = .cardPartTitleColor public var titleViewMargins: UIEdgeInsets = UIEdgeInsets(top: 5.0, left: 28.0, bottom: 10.0, right: 28.0) - + // CardPartButtonView - public var buttonTitleFont: UIFont = UIFont.turboGenericFont(.large) - public var buttonTitleColor: UIColor = UIColor.turboBlueColor - public var buttonCornerRadius: CGFloat = CGFloat(0.0) - + public var buttonTitleFont: UIFont = .cardPartsFont(.large) + public var buttonTitleColor: UIColor = .cardPartBlueColor + public var buttonCornerRadius: CGFloat = .zero + // CardPartBarView - public var barBackgroundColor: UIColor = UIColor.turboSeperatorGray - public var barColor: UIColor = UIColor.turboHeaderBlueColor - public var todayLineColor: UIColor = UIColor.Gray8 + public var barBackgroundColor: UIColor = .TertiarySystemFill + public var barColor: UIColor = .cardPartHeaderBlueColor + public var todayLineColor: UIColor = .SystemFill public var barHeight: CGFloat = 20.0 public var roundedCorners: Bool = true public var showTodayLine: Bool = false - + // CardPartTableView public var tableViewMargins: UIEdgeInsets = UIEdgeInsets(top: 0.0, left: 28.0, bottom: 0.0, right: 28.0) - + // CardPartTableViewCell and CardPartTitleDescriptionView - public var leftTitleFont: UIFont = UIFont.turboGenericFont(.large) - public var leftDescriptionFont: UIFont = UIFont.turboGenericFont(.small) - public var rightTitleFont: UIFont = UIFont.turboGenericFont(.large) - public var rightDescriptionFont: UIFont = UIFont.turboGenericFont(.small) - public var leftTitleColor: UIColor = UIColor.turboCardPartTitleColor - public var leftDescriptionColor: UIColor = UIColor.turboGenericGreyTextColor - public var rightTitleColor: UIColor = UIColor.turboCardPartTitleColor - public var rightDescriptionColor: UIColor = UIColor.turboGenericGreyTextColor + public var leftTitleFont: UIFont = .cardPartsFont(.large) + public var leftDescriptionFont: UIFont = .cardPartsFont(.small) + public var rightTitleFont: UIFont = .cardPartsFont(.large) + public var rightDescriptionFont: UIFont = .cardPartsFont(.small) + public var leftTitleColor: UIColor = .cardPartTitleColor + public var leftDescriptionColor: UIColor = .cardPartGrayTextColor + public var rightTitleColor: UIColor = .cardPartTitleColor + public var rightDescriptionColor: UIColor = .cardPartGrayTextColor public var secondaryTitlePosition : CardPartSecondaryTitleDescPosition = .center(amount: 0.0) - + public init() { } - } - diff --git a/CardParts/src/Classes/CardsViewController.swift b/CardParts/src/Classes/CardsViewController.swift index 1db17374..43aa69a1 100644 --- a/CardParts/src/Classes/CardsViewController.swift +++ b/CardParts/src/Classes/CardsViewController.swift @@ -75,7 +75,7 @@ open class CardsViewController : UIViewController, UICollectionViewDataSource, U collectionView.translatesAutoresizingMaskIntoConstraints = false collectionView.delegate = self - collectionView.backgroundColor = UIColor.color(245, green: 245, blue: 245) + collectionView.backgroundColor = CardParts.theme.backgroundColor // collectionView.register(CardCell.self, forCellWithReuseIdentifier: kCardCellIndentifier) collectionView.dataSource = self let insets = UIEdgeInsets(top: CardParts.theme.cardsViewContentInsetTop, left: 0, bottom: (tabBarController?.tabBar.bounds.size.height ?? 0) + layout.minimumLineSpacing * 2, right: 0) diff --git a/CardParts/src/Extensions/UIColor.swift b/CardParts/src/Extensions/UIColor.swift index b21187d3..eca1aa0a 100644 --- a/CardParts/src/Extensions/UIColor.swift +++ b/CardParts/src/Extensions/UIColor.swift @@ -7,17 +7,25 @@ // extension UIColor { + class func color(_ red: Int, green: Int, blue: Int, alpha: CGFloat = 1.0) -> UIColor { + return UIColor(red: CGFloat(red) / 255, green: CGFloat(green) / 255, blue: CGFloat(blue) / 255, alpha: alpha) + } + + static func colorFromHex(_ rgbValue:UInt32)->UIColor{ + let red = CGFloat((rgbValue & 0xFF0000) >> 16)/256.0 + let green = CGFloat((rgbValue & 0xFF00) >> 8)/256.0 + let blue = CGFloat(rgbValue & 0xFF)/256.0 + return UIColor(red:red, green:green, blue:blue, alpha:1.0) + } + + static var cardPartGrayTextColor : UIColor {get{return UIColor.dynamicColor(light: .Gray2, dark: .Gray3)}} + static var cardPartTitleColor : UIColor {get{return UIColor.dynamicColor(light: .Black, dark: .white)}} + static var cardPartTextColor : UIColor {get{return UIColor.dynamicColor(light: .Gray0, dark: .Gray7)}} + static var cardPartSeparatorColor : UIColor {get{return UIColor.dynamicColor(light: .Gray4, dark: .Gray2)}} + static var cardPartBlueColor : UIColor {get{return .SystemBlue}} + static var cardPartHeaderBlueColor: UIColor { get { return .SystemBlue}} + static var cardPartGreenColor : UIColor {get{return UIColor.dynamicColor(light: UIColor.colorFromHex(0x0AC775), dark: UIColor.colorFromHex(0x3DFAA8))}} - static var turboGenericGreyTextColor : UIColor {get{return UIColor.color(169, green: 169, blue: 169)}} - static var turboCardPartTitleColor : UIColor {get{return UIColor.color(17, green: 17, blue: 17)}} - static var turboCardPartTextColor : UIColor {get{return UIColor.color(136, green: 136, blue: 136)}} - static var cardPartAttributedTextColor : UIColor {get{return UIColor.color(0, green: 0, blue: 255)}} - - static var turboSeperatorColor : UIColor {get{return UIColor.color(221, green: 221, blue: 221)}} - static var turboBlueColor : UIColor {get{return UIColor(red: 69.0/255.0, green: 202.0/255.0, blue: 230.0/255.0, alpha: 1.0)}} - static var turboHeaderBlueColor: UIColor { get { return UIColor.colorFromHex(0x05A4B5) }} - static var turboGreenColor : UIColor {get{return UIColor(red: 10.0/255.0, green: 199.0/255.0, blue: 117.0/255.0, alpha: 1.0)}} - static var turboSeperatorGray : UIColor {get{return UIColor(red: 221.0/255.0, green: 221.0/255.0, blue: 221.0/255.0, alpha: 1.0)}} static var Black : UIColor {get{return UIColor.colorFromHex(0x000000)}} static var Gray0 : UIColor {get{return UIColor.colorFromHex(0x333333)}} static var Gray1 : UIColor {get{return UIColor.colorFromHex(0x666666)}} @@ -28,24 +36,91 @@ extension UIColor { static var Gray6 : UIColor {get{return UIColor.colorFromHex(0xF5F5F5)}} static var Gray7 : UIColor {get{return UIColor.colorFromHex(0xE7E7E7)}} static var Gray8 : UIColor {get{return UIColor.colorFromHex(0xB2B2B2)}} + + //Confetti Colors + public static var flushOrange : UIColor {get{return UIColor.dynamicColor(light: UIColor.colorFromHex(0xFF8000), dark: UIColor.colorFromHex(0xFF9A1A))}} + public static var eggBlue : UIColor {get{return UIColor.dynamicColor(light: UIColor.colorFromHex(0x07C4D9), dark: UIColor.colorFromHex(0x21DEF3))}} + public static var blushPink: UIColor {get{return UIColor.dynamicColor(light: UIColor.colorFromHex(0xFF88EC), dark: UIColor.colorFromHex(0xFFA2FF))}} + public static var cerulean: UIColor {get{return UIColor.dynamicColor(light: UIColor.colorFromHex(0x0097E6), dark: UIColor.colorFromHex(0x1AB1FF))}} + public static var limeGreen: UIColor {get{return UIColor.dynamicColor(light: UIColor.colorFromHex(0x53B700), dark: UIColor.colorFromHex(0x6DD11A))}} + public static var yellowSea: UIColor {get{return UIColor.dynamicColor(light: UIColor.colorFromHex(0xFFAD00), dark: UIColor.colorFromHex(0xFFC71A))}} + public static var superNova: UIColor {get{return UIColor.dynamicColor(light: UIColor.colorFromHex(0xFFCA00), dark: UIColor.colorFromHex(0xFFE41A))}} +} + +// MARK: - Pre-iOS 13 Compatibility + +extension UIColor { + // Adaptable Colors + static var SystemBlue : UIColor {get {if #available(iOS 13.0, *){return .systemBlue} else {return UIColor.color(0, green: 122, blue: 255)}}} + static var SystemGreen : UIColor {get {if #available(iOS 13.0, *){return .systemGreen} else {return UIColor.color(52, green: 199, blue: 89)}}} + static var SystemIndigo : UIColor {get {if #available(iOS 13.0, *){return .systemIndigo} else {return UIColor.color(88, green: 86, blue: 214)}}} + static var SystemOrange : UIColor {get {if #available(iOS 13.0, *){return .systemOrange} else {return UIColor.color(255, green: 149, blue: 0)}}} + static var SystemPink : UIColor {get {if #available(iOS 13.0, *){return .systemPink} else {return UIColor.color(255, green: 45, blue: 85)}}} + static var SystemPurple : UIColor {get {if #available(iOS 13.0, *){return .systemPurple} else {return UIColor.color(175, green: 82, blue: 222)}}} + static var SystemRed : UIColor {get {if #available(iOS 13.0, *){return .systemRed} else {return UIColor.color(255, green: 59, blue: 48)}}} + static var SystemTeal : UIColor {get {if #available(iOS 13.0, *){return .systemTeal} else {return UIColor.color(90, green: 200, blue: 250)}}} + static var SystemYellow : UIColor {get {if #available(iOS 13.0, *){return .systemYellow} else {return UIColor.color(255, green: 204, blue: 0)}}} - class func color(_ red: Int, green: Int, blue: Int) -> UIColor { - return UIColor(red: CGFloat(red) / 255, green: CGFloat(green) / 255, blue: CGFloat(blue) / 255, alpha: 1) - } + // Adaptable Gray Colors + static var SystemGray : UIColor {get {if #available(iOS 13.0, *){return .systemGray} else {return UIColor.color(142, green: 142, blue: 147)}}} + static var SystemGray2 : UIColor {get {if #available(iOS 13.0, *){return .systemGray2} else {return UIColor.color(174, green: 174, blue: 178)}}} + static var SystemGray3 : UIColor {get {if #available(iOS 13.0, *){return .systemGray3} else {return UIColor.color(199, green: 199, blue: 204)}}} + static var SystemGray4 : UIColor {get {if #available(iOS 13.0, *){return .systemGray4} else {return UIColor.color(209, green: 209, blue: 214)}}} + static var SystemGray5 : UIColor {get {if #available(iOS 13.0, *){return .systemGray5} else {return UIColor.color(229, green: 229, blue: 234)}}} + static var SystemGray6 : UIColor {get {if #available(iOS 13.0, *){return .systemGray6} else {return UIColor.color(242, green: 242, blue: 247)}}} - static func colorFromHex(_ rgbValue:UInt32)->UIColor{ - let red = CGFloat((rgbValue & 0xFF0000) >> 16)/256.0 - let green = CGFloat((rgbValue & 0xFF00) >> 8)/256.0 - let blue = CGFloat(rgbValue & 0xFF)/256.0 - return UIColor(red:red, green:green, blue:blue, alpha:1.0) + // Label Colors + static var Label : UIColor {get {if #available(iOS 13.0, *){return .label} else {return UIColor.color(242, green: 242, blue: 247)}}} + static var SecondaryLabel : UIColor {get {if #available(iOS 13.0, *){return .secondaryLabel} else {return UIColor.color(242, green: 242, blue: 247)}}} + static var TertiaryLabel : UIColor {get {if #available(iOS 13.0, *){return .tertiaryLabel} else {return UIColor.color(242, green: 242, blue: 247)}}} + static var QuaternaryLabel : UIColor {get {if #available(iOS 13.0, *){return .quaternaryLabel} else {return UIColor.color(242, green: 242, blue: 247)}}} + + // Fill Colors + static var SystemFill : UIColor {get {if #available(iOS 13.0, *){return .systemFill} else {return UIColor.color(120, green: 120, blue: 128, alpha: 0.2)}}} + static var SecondarySystemFill : UIColor {get {if #available(iOS 13.0, *){return .secondarySystemFill} else {return UIColor.color(120, green: 120, blue: 128, alpha: 0.16)}}} + static var TertiarySystemFill : UIColor {get {if #available(iOS 13.0, *){return .tertiarySystemFill} else {return UIColor.color(120, green: 120, blue: 128, alpha: 0.12)}}} + static var QuaternarySystemFill : UIColor {get {if #available(iOS 13.0, *){return .quaternarySystemFill} else {return UIColor.color(120, green: 120, blue: 128, alpha: 0.08)}}} + + // Text Colors + static var PlaceholderText : UIColor {get {if #available(iOS 13.0, *){return .placeholderText} else {return UIColor.color(242, green: 242, blue: 247)}}} + + // Standard Content Background Colors + static var SystemBackground : UIColor {get {if #available(iOS 13.0, *){return .systemBackground} else {return UIColor.color(255, green: 255, blue: 255)}}} + static var SecondarySystemBackground : UIColor {get {if #available(iOS 13.0, *){return .secondarySystemBackground} else {return UIColor.color(242, green: 242, blue: 247)}}} + static var TertiarySystemBackground : UIColor {get {if #available(iOS 13.0, *){return .tertiarySystemBackground} else {return UIColor.color(255, green: 255, blue: 255)}}} + + // Grouped Content Background Colors + static var SystemGroupedBackground : UIColor {get {if #available(iOS 13.0, *){return .systemGroupedBackground} else {return UIColor.color(242, green: 242, blue: 247)}}} + static var SecondarySystemGroupedBackground : UIColor {get {if #available(iOS 13.0, *){return .secondarySystemGroupedBackground} else {return UIColor.color(255, green: 255, blue: 255)}}} + static var TertiarySystemGroupedBackground : UIColor {get {if #available(iOS 13.0, *){return .tertiarySystemGroupedBackground} else {return UIColor.color(242, green: 242, blue: 247)}}} + + // Separator Colors + static var Separator : UIColor {get {if #available(iOS 13.0, *){return .separator} else {return UIColor.color(242, green: 242, blue: 247)}}} + static var OpaqueSeparator : UIColor {get {if #available(iOS 13.0, *){return .opaqueSeparator} else {return UIColor.color(242, green: 242, blue: 247)}}} + + // Link Color + static var Link : UIColor {get {if #available(iOS 13.0, *){return .link} else {return UIColor.color(242, green: 242, blue: 247)}}} + + // Nonadaptable Colors + static var DarkText : UIColor {get {if #available(iOS 13.0, *){return .link} else {return UIColor.color(242, green: 242, blue: 247)}}} + + static func dynamicColor(light: UIColor, dark: UIColor) -> UIColor { + if #available(iOS 13.0, *) { + return UIColor(dynamicProvider: { traits in + if traits.userInterfaceStyle == .dark { + return dark + } + return light + }) + } + return light } - //Confetti Colors - public static var flushOrange : UIColor {get{return UIColor.colorFromHex(0xFF8000)}} - public static var eggBlue : UIColor {get{return UIColor.colorFromHex(0x07C4D9)}} - public static var blushPink: UIColor {get{return UIColor.colorFromHex(0xFF88EC)}} - public static var cerulean: UIColor {get{return UIColor.colorFromHex(0x0097E6)}} - public static var limeGreen: UIColor {get{return UIColor.colorFromHex(0x53B700)}} - public static var yellowSea: UIColor {get{return UIColor.colorFromHex(0xFFAD00)}} - public static var superNova: UIColor {get{return UIColor.colorFromHex(0xFFCA00)}} + // CGColor for traitCollection + func cgColor(with traitCollection: UITraitCollection) -> CGColor { + if #available(iOS 13.0, *) { + return self.resolvedColor(with: traitCollection).cgColor + } + return self.cgColor + } } diff --git a/CardParts/src/Extensions/UIFont.swift b/CardParts/src/Extensions/UIFont.swift index bacd6cb6..406d1e91 100644 --- a/CardParts/src/Extensions/UIFont.swift +++ b/CardParts/src/Extensions/UIFont.swift @@ -12,35 +12,35 @@ enum FontSize: Int { extension UIFont { - class func turboGenericFont(_ fontSize: FontSize) -> UIFont { + class func cardPartsFont(_ fontSize: FontSize) -> UIFont { return UIFont.systemFont(ofSize: CGFloat(fontSize.rawValue), weight: UIFont.Weight.regular) } - class func turboGenericFontBlack(_ fontSize: FontSize) -> UIFont { + class func cardPartsFontBlack(_ fontSize: FontSize) -> UIFont { return UIFont.systemFont(ofSize: CGFloat(fontSize.rawValue), weight: UIFont.Weight.black) } - class func turboGenericFontBold(_ fontSize: FontSize) -> UIFont { + class func cardPartsFontBold(_ fontSize: FontSize) -> UIFont { return UIFont.systemFont(ofSize: CGFloat(fontSize.rawValue), weight: UIFont.Weight.bold) } - class func turboGenericMediumFont(_ fontSize: FontSize) -> UIFont { + class func cardPartsMediumFont(_ fontSize: FontSize) -> UIFont { return UIFont.systemFont(ofSize: CGFloat(fontSize.rawValue), weight: UIFont.Weight.medium) } - class func turboGenericLightFont(_ fontSize: FontSize) -> UIFont { + class func cardPartsLightFont(_ fontSize: FontSize) -> UIFont { return UIFont.systemFont(ofSize: CGFloat(fontSize.rawValue), weight: UIFont.Weight.light) } - class func turboGenericFontWithSize(_ size: CGFloat) -> UIFont { + class func cardPartsFontWithSize(_ size: CGFloat) -> UIFont { return UIFont.systemFont(ofSize: size, weight: UIFont.Weight.regular) } - class func turboGenericMediumFontWithSize(_ size: CGFloat) -> UIFont { + class func cardPartsMediumFontWithSize(_ size: CGFloat) -> UIFont { return UIFont.systemFont(ofSize: size, weight: UIFont.Weight.medium) } - class func turboGenericLightFontWithSize(_ size: CGFloat) -> UIFont { + class func cardPartsLightFontWithSize(_ size: CGFloat) -> UIFont { return UIFont.systemFont(ofSize: size, weight: UIFont.Weight.light) } diff --git a/Example/CardParts.xcodeproj/project.pbxproj b/Example/CardParts.xcodeproj/project.pbxproj index c4ad2aa2..78af9bbf 100644 --- a/Example/CardParts.xcodeproj/project.pbxproj +++ b/Example/CardParts.xcodeproj/project.pbxproj @@ -52,9 +52,11 @@ 70F595DA20B5C9F200B6E688 /* CardPartStackViewCardController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70F595D920B5C9F200B6E688 /* CardPartStackViewCardController.swift */; }; 70F595DC20B5CAF800B6E688 /* CardPartTableViewCardController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70F595DB20B5CAF800B6E688 /* CardPartTableViewCardController.swift */; }; 70F595E020B5CDCE00B6E688 /* CardPartCollectionViewCardController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70F595DF20B5CDCE00B6E688 /* CardPartCollectionViewCardController.swift */; }; + 7103BDEE9A134BAD4917AC05 /* Pods_CardParts_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C2FF4E2B43A7D0CE08F17CA7 /* Pods_CardParts_Tests.framework */; }; 80F3C7662348F32300F5D271 /* CardPartMapViewCardController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80F3C7652348F32300F5D271 /* CardPartMapViewCardController.swift */; }; 80F3C768234ADA7900F5D271 /* CardPartMapViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80F3C767234ADA7900F5D271 /* CardPartMapViewTests.swift */; }; EB16E38A2396E8FD003F70A2 /* CardParthCustomMarginsCardController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB16E3892396E8FD003F70A2 /* CardParthCustomMarginsCardController.swift */; }; + C4A61B70002EE2BDD1658194 /* Pods_CardParts_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3A8CBD5FBA59826A0B878E44 /* Pods_CardParts_Example.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -79,15 +81,11 @@ 1BCE6B772360AE26006B7325 /* CardPartRadioButtonCardController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardPartRadioButtonCardController.swift; sourceTree = ""; }; 1BD1073F22F22823000163D2 /* CardPartBorderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardPartBorderViewController.swift; sourceTree = ""; }; 2BA2B86E3C2946F91C18390D /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; - 2C0391CB2C9A48987E449BE1 /* Pods-CardParts_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CardParts_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CardParts_Tests/Pods-CardParts_Tests.debug.xcconfig"; sourceTree = ""; }; 30570F5B2E2268AA7B34EEC0 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; - 3274FA90B83B27385FE1EC09 /* Pods-CardParts_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CardParts_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-CardParts_Example/Pods-CardParts_Example.release.xcconfig"; sourceTree = ""; }; - 40FADEDFCAAAB84F115A1C2B /* Pods-CardParts_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CardParts_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CardParts_Example/Pods-CardParts_Example.debug.xcconfig"; sourceTree = ""; }; - 411FA9F08E0EF1AF5B1D8EA1 /* Pods_CardParts_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CardParts_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 3A8CBD5FBA59826A0B878E44 /* Pods_CardParts_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CardParts_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 5570914220D18B07004D8E5A /* CardPartOrientedViewCardController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardPartOrientedViewCardController.swift; sourceTree = ""; }; 55809E2520DABBF3008BE0D2 /* CardPartCenteredViewCardController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardPartCenteredViewCardController.swift; sourceTree = ""; }; 55AB80CE20B61E1700B5994B /* CardUtilsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardUtilsTests.swift; sourceTree = ""; }; - 58D33E4374206E3A72623089 /* Pods-CardParts_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CardParts_Example.release.xcconfig"; path = "Target Support Files/Pods-CardParts_Example/Pods-CardParts_Example.release.xcconfig"; sourceTree = ""; }; 607FACD01AFB9204008FA782 /* CardParts_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CardParts_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -107,6 +105,7 @@ 61D4706E1FDA709B00F451F0 /* CardPartButtonViewTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardPartButtonViewTests.swift; sourceTree = ""; }; 61D4706F1FDA709B00F451F0 /* CardPartSpacerViewTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardPartSpacerViewTests.swift; sourceTree = ""; }; 61D470841FDB08EE00F451F0 /* CardPartTitleDescriptionViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardPartTitleDescriptionViewTests.swift; sourceTree = ""; }; + 69EC0ADC6D3429CB605C66DD /* Pods-CardParts_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CardParts_Example.debug.xcconfig"; path = "Target Support Files/Pods-CardParts_Example/Pods-CardParts_Example.debug.xcconfig"; sourceTree = ""; }; 7021D3D120B5FA8600F9CB80 /* ThemedCardController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemedCardController.swift; sourceTree = ""; }; 7051279A20B5D35900B8E635 /* CardPartBarViewCardController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardPartBarViewCardController.swift; sourceTree = ""; }; 7051279C20B5D3D900B8E635 /* CardPartPagedViewCardController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardPartPagedViewCardController.swift; sourceTree = ""; }; @@ -127,10 +126,11 @@ B21177744B384387575CB614 /* Pods-CardParts_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CardParts_Tests.debug.xcconfig"; path = "Target Support Files/Pods-CardParts_Tests/Pods-CardParts_Tests.debug.xcconfig"; sourceTree = ""; }; E768E0B2422010080EDB1A52 /* Pods-CardParts_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CardParts_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CardParts_Tests/Pods-CardParts_Tests.release.xcconfig"; sourceTree = ""; }; EB16E3892396E8FD003F70A2 /* CardParthCustomMarginsCardController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardParthCustomMarginsCardController.swift; sourceTree = ""; }; + 9C1986106E7F060E20B3DE1E /* Pods-CardParts_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CardParts_Tests.debug.xcconfig"; path = "Target Support Files/Pods-CardParts_Tests/Pods-CardParts_Tests.debug.xcconfig"; sourceTree = ""; }; + C2FF4E2B43A7D0CE08F17CA7 /* Pods_CardParts_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CardParts_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + E5A5CAD428F49767A3C551A5 /* Pods-CardParts_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CardParts_Example.release.xcconfig"; path = "Target Support Files/Pods-CardParts_Example/Pods-CardParts_Example.release.xcconfig"; sourceTree = ""; }; + E87805F09ECF940869D9ADEE /* Pods-CardParts_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CardParts_Tests.release.xcconfig"; path = "Target Support Files/Pods-CardParts_Tests/Pods-CardParts_Tests.release.xcconfig"; sourceTree = ""; }; ED96724FD3D3088F4E52A4B3 /* CardParts.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = CardParts.podspec; path = ../CardParts.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; - EDB3B26F1BF024EF68A0F8CC /* Pods-CardParts_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CardParts_Tests.release.xcconfig"; path = "Target Support Files/Pods-CardParts_Tests/Pods-CardParts_Tests.release.xcconfig"; sourceTree = ""; }; - F639F94EB1911C332F07F7C5 /* Pods_CardParts_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CardParts_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - FB125B7758C7A2765F5C9714 /* Pods-CardParts_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CardParts_Example.debug.xcconfig"; path = "Target Support Files/Pods-CardParts_Example/Pods-CardParts_Example.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -138,7 +138,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 0AC06A50F9EFC07A051126DA /* Pods_CardParts_Example.framework in Frameworks */, + C4A61B70002EE2BDD1658194 /* Pods_CardParts_Example.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -146,7 +146,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 1964FC2A3640A8318B06FAE2 /* Pods_CardParts_Tests.framework in Frameworks */, + 7103BDEE9A134BAD4917AC05 /* Pods_CardParts_Tests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -161,7 +161,7 @@ 607FACE81AFB9204008FA782 /* Tests */, 607FACD11AFB9204008FA782 /* Products */, BABC66A8CBE4FFFB18E62FFE /* Pods */, - 87F0B966E5030117E89059DF /* Frameworks */, + A2C2FE6DFC42DFA2226B7D2C /* Frameworks */, ); sourceTree = ""; }; @@ -271,11 +271,11 @@ name = "Type of CardParts"; sourceTree = ""; }; - 87F0B966E5030117E89059DF /* Frameworks */ = { + A2C2FE6DFC42DFA2226B7D2C /* Frameworks */ = { isa = PBXGroup; children = ( - F639F94EB1911C332F07F7C5 /* Pods_CardParts_Example.framework */, - 411FA9F08E0EF1AF5B1D8EA1 /* Pods_CardParts_Tests.framework */, + 3A8CBD5FBA59826A0B878E44 /* Pods_CardParts_Example.framework */, + C2FF4E2B43A7D0CE08F17CA7 /* Pods_CardParts_Tests.framework */, ); name = Frameworks; sourceTree = ""; @@ -283,14 +283,10 @@ BABC66A8CBE4FFFB18E62FFE /* Pods */ = { isa = PBXGroup; children = ( - FB125B7758C7A2765F5C9714 /* Pods-CardParts_Example.debug.xcconfig */, - 58D33E4374206E3A72623089 /* Pods-CardParts_Example.release.xcconfig */, - B21177744B384387575CB614 /* Pods-CardParts_Tests.debug.xcconfig */, - EDB3B26F1BF024EF68A0F8CC /* Pods-CardParts_Tests.release.xcconfig */, - 40FADEDFCAAAB84F115A1C2B /* Pods-CardParts_Example.debug.xcconfig */, - 3274FA90B83B27385FE1EC09 /* Pods-CardParts_Example.release.xcconfig */, - 2C0391CB2C9A48987E449BE1 /* Pods-CardParts_Tests.debug.xcconfig */, - E768E0B2422010080EDB1A52 /* Pods-CardParts_Tests.release.xcconfig */, + 69EC0ADC6D3429CB605C66DD /* Pods-CardParts_Example.debug.xcconfig */, + E5A5CAD428F49767A3C551A5 /* Pods-CardParts_Example.release.xcconfig */, + 9C1986106E7F060E20B3DE1E /* Pods-CardParts_Tests.debug.xcconfig */, + E87805F09ECF940869D9ADEE /* Pods-CardParts_Tests.release.xcconfig */, ); path = Pods; sourceTree = ""; @@ -302,11 +298,11 @@ isa = PBXNativeTarget; buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "CardParts_Example" */; buildPhases = ( - BB601C2A9A2BAECC51F571D1 /* [CP] Check Pods Manifest.lock */, + 1F536BA041CAAF2388243E9C /* [CP] Check Pods Manifest.lock */, 607FACCC1AFB9204008FA782 /* Sources */, 607FACCD1AFB9204008FA782 /* Frameworks */, 607FACCE1AFB9204008FA782 /* Resources */, - 2B9B7383D03B89214C749584 /* [CP] Embed Pods Frameworks */, + 2EE1472D916DECF16C0FC6C5 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -321,11 +317,11 @@ isa = PBXNativeTarget; buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "CardParts_Tests" */; buildPhases = ( - 90BAACBDEF50357EFD255920 /* [CP] Check Pods Manifest.lock */, + 36AF48F8B8951914311392E9 /* [CP] Check Pods Manifest.lock */, 607FACE11AFB9204008FA782 /* Sources */, 607FACE21AFB9204008FA782 /* Frameworks */, 607FACE31AFB9204008FA782 /* Resources */, - 12987F7420BBBE1513625EA6 /* [CP] Embed Pods Frameworks */, + A22914B74541F5625F7A31F0 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -400,35 +396,29 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 12987F7420BBBE1513625EA6 /* [CP] Embed Pods Frameworks */ = { + 1F536BA041CAAF2388243E9C /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); + inputFileListPaths = ( + ); inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-CardParts_Tests/Pods-CardParts_Tests-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/CardParts/CardParts.framework", - "${BUILT_PRODUCTS_DIR}/Differentiator/Differentiator.framework", - "${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework", - "${BUILT_PRODUCTS_DIR}/RxDataSources/RxDataSources.framework", - "${BUILT_PRODUCTS_DIR}/RxGesture/RxGesture.framework", - "${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework", + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( ); - name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CardParts.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Differentiator.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxDataSources.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxGesture.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework", + "$(DERIVED_FILE_DIR)/Pods-CardParts_Example-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CardParts_Tests/Pods-CardParts_Tests-frameworks.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 2B9B7383D03B89214C749584 /* [CP] Embed Pods Frameworks */ = { + 2EE1472D916DECF16C0FC6C5 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -456,7 +446,7 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CardParts_Example/Pods-CardParts_Example-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 90BAACBDEF50357EFD255920 /* [CP] Check Pods Manifest.lock */ = { + 36AF48F8B8951914311392E9 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -478,26 +468,32 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - BB601C2A9A2BAECC51F571D1 /* [CP] Check Pods Manifest.lock */ = { + A22914B74541F5625F7A31F0 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); - inputFileListPaths = ( - ); inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-CardParts_Tests/Pods-CardParts_Tests-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/CardParts/CardParts.framework", + "${BUILT_PRODUCTS_DIR}/Differentiator/Differentiator.framework", + "${BUILT_PRODUCTS_DIR}/RxCocoa/RxCocoa.framework", + "${BUILT_PRODUCTS_DIR}/RxDataSources/RxDataSources.framework", + "${BUILT_PRODUCTS_DIR}/RxGesture/RxGesture.framework", + "${BUILT_PRODUCTS_DIR}/RxSwift/RxSwift.framework", ); + name = "[CP] Embed Pods Frameworks"; outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-CardParts_Example-checkManifestLockResult.txt", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CardParts.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Differentiator.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxCocoa.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxDataSources.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxGesture.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxSwift.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CardParts_Tests/Pods-CardParts_Tests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -697,7 +693,7 @@ }; 607FACF01AFB9204008FA782 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FB125B7758C7A2765F5C9714 /* Pods-CardParts_Example.debug.xcconfig */; + baseConfigurationReference = 69EC0ADC6D3429CB605C66DD /* Pods-CardParts_Example.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Manual; @@ -716,7 +712,7 @@ }; 607FACF11AFB9204008FA782 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 58D33E4374206E3A72623089 /* Pods-CardParts_Example.release.xcconfig */; + baseConfigurationReference = E5A5CAD428F49767A3C551A5 /* Pods-CardParts_Example.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Manual; @@ -735,7 +731,7 @@ }; 607FACF31AFB9204008FA782 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = B21177744B384387575CB614 /* Pods-CardParts_Tests.debug.xcconfig */; + baseConfigurationReference = 9C1986106E7F060E20B3DE1E /* Pods-CardParts_Tests.debug.xcconfig */; buildSettings = { CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = ""; @@ -755,7 +751,7 @@ }; 607FACF41AFB9204008FA782 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = EDB3B26F1BF024EF68A0F8CC /* Pods-CardParts_Tests.release.xcconfig */; + baseConfigurationReference = E87805F09ECF940869D9ADEE /* Pods-CardParts_Tests.release.xcconfig */; buildSettings = { CODE_SIGN_STYLE = Manual; DEVELOPMENT_TEAM = ""; diff --git a/Example/CardParts/AppDelegate.swift b/Example/CardParts/AppDelegate.swift index b59e7cb1..228b85e1 100644 --- a/Example/CardParts/AppDelegate.swift +++ b/Example/CardParts/AppDelegate.swift @@ -16,7 +16,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - // Override point for customization after application launch. return true } diff --git a/Example/CardParts/Base.lproj/Main.storyboard b/Example/CardParts/Base.lproj/Main.storyboard index 6183ee6e..4784082f 100644 --- a/Example/CardParts/Base.lproj/Main.storyboard +++ b/Example/CardParts/Base.lproj/Main.storyboard @@ -1,11 +1,9 @@ - - - - + + - + @@ -20,7 +18,7 @@ - + @@ -39,7 +37,7 @@ - + @@ -55,7 +53,6 @@ - @@ -78,7 +75,7 @@ - + diff --git a/Example/CardParts/CardPartAttributedTextViewController.swift b/Example/CardParts/CardPartAttributedTextViewController.swift index e3135cf8..c3973867 100644 --- a/Example/CardParts/CardPartAttributedTextViewController.swift +++ b/Example/CardParts/CardPartAttributedTextViewController.swift @@ -28,8 +28,6 @@ class CardPartAttributedTextViewController: CardPartsViewController { gestureRecognizer.isEnabled = true }) - cardPartAttributedTextView.backgroundColor = UIColor.white - cardPartImage.contentMode = .center cardPartAttributedTextView.addSubview(cardPartImage) cardPartAttributedTextView.textViewImage = cardPartImage @@ -39,6 +37,4 @@ class CardPartAttributedTextViewController: CardPartsViewController { setupCardParts([cardPartAttributedTextView]) } - - } diff --git a/Example/CardParts/CardPartBarViewCardController.swift b/Example/CardParts/CardPartBarViewCardController.swift index 1fa9235d..7683e6a7 100644 --- a/Example/CardParts/CardPartBarViewCardController.swift +++ b/Example/CardParts/CardPartBarViewCardController.swift @@ -20,7 +20,7 @@ class CardPartBarViewCardController: CardPartsViewController { cardPartTextView.text = "This is a CardPartBarView" cardPartBarView.percent = 0.5 - cardPartBarView.barColor = .blue + cardPartBarView.barColor = .systemBlue setupCardParts([cardPartTextView, cardPartBarView]) } diff --git a/Example/CardParts/CardPartBorderViewController.swift b/Example/CardParts/CardPartBorderViewController.swift index f9c5fef4..9d84eac3 100644 --- a/Example/CardParts/CardPartBorderViewController.swift +++ b/Example/CardParts/CardPartBorderViewController.swift @@ -18,8 +18,8 @@ class CardPartBorderViewController: CardPartsViewController, BorderCardTrait, Ro return 2.0 } - func borderColor() -> CGColor { - return UIColor.darkGray.cgColor + func borderColor() -> UIColor { + return UIColor.systemGray } diff --git a/Example/CardParts/CardPartCollectionViewCardController.swift b/Example/CardParts/CardPartCollectionViewCardController.swift index 1afd73e8..196bfd86 100644 --- a/Example/CardParts/CardPartCollectionViewCardController.swift +++ b/Example/CardParts/CardPartCollectionViewCardController.swift @@ -61,10 +61,15 @@ class CardPartCollectionViewCardController: CardPartsViewController { cell.setData(data) - cell.backgroundColor = UIColor.lightGray cell.layer.cornerRadius = 5 cell.layer.borderWidth = 1 - cell.layer.borderColor = UIColor(red: 0.93, green: 0.93, blue: 0.95, alpha: 1.0).cgColor + + if #available(iOS 13.0, *) { + cell.backgroundColor = UIColor.quaternarySystemFill + cell.borderColor = UIColor.separator + } else { + cell.backgroundColor = UIColor.lightGray + } return cell }) @@ -120,10 +125,16 @@ class MyCustomCollectionViewCell: CardPartCollectionViewCardPartsCell { titleCP.text = data.title titleCP.textAlignment = .center - titleCP.textColor = .white descriptionCP.text = data.description descriptionCP.textAlignment = .center - descriptionCP.textColor = .white + + if #available(iOS 13.0, *) { + titleCP.textColor = .label + descriptionCP.textColor = .secondaryLabel + } else { + titleCP.textColor = .white + descriptionCP.textColor = .white + } } } diff --git a/Example/CardParts/CardPartIconLabelCardController.swift b/Example/CardParts/CardPartIconLabelCardController.swift index 2ee0354a..bfab347a 100644 --- a/Example/CardParts/CardPartIconLabelCardController.swift +++ b/Example/CardParts/CardPartIconLabelCardController.swift @@ -28,13 +28,25 @@ class CardPartIconLabelCardController: CardPartsViewController { let iconLabel = CardPartIconLabel() iconLabel.verticalPadding = 10 iconLabel.horizontalPadding = 10 - iconLabel.backgroundColor = UIColor(red: 16.0 / 255.0, green: 128.0 / 255.0, blue: 0, alpha: 0.16) iconLabel.font = UIFont.systemFont(ofSize: 12) - iconLabel.textColor = UIColor.black + if #available(iOS 13.0, *) { + iconLabel.textColor = UIColor.label + iconLabel.tintColor = UIColor.label + iconLabel.backgroundColor = UIColor(dynamicProvider: { traitCollection in + if traitCollection.userInterfaceStyle == .dark { + return UIColor(red: 27.0 / 255.0, green: 223.0 / 255.0, blue: 0, alpha: 0.16) + } + return UIColor(red: 16.0 / 255.0, green: 128.0 / 255.0, blue: 0, alpha: 0.16) + }) + } else { + iconLabel.textColor = UIColor.black + iconLabel.tintColor = UIColor.black + iconLabel.backgroundColor = UIColor(red: 16.0 / 255.0, green: 128.0 / 255.0, blue: 0, alpha: 0.16) + } iconLabel.numberOfLines = 0 iconLabel.iconPadding = 5 iconLabel.layer.cornerRadius = 8.0 - iconLabel.icon = UIImage(named: "themeIcon") + iconLabel.icon = UIImage(named: "themeIcon")?.withRenderingMode(.alwaysTemplate) switch index { case 0: diff --git a/Example/CardParts/CardPartPillLabelCardController.swift b/Example/CardParts/CardPartPillLabelCardController.swift index 44e63781..860c276a 100644 --- a/Example/CardParts/CardPartPillLabelCardController.swift +++ b/Example/CardParts/CardPartPillLabelCardController.swift @@ -26,19 +26,13 @@ class CardPartPillLabelCardController: CardPartsViewController { label1.text = "Label1" label1.verticalPadding = 10 label1.horizontalPadding = 10 - label1.backgroundColor = UIColor.black - label1.textColor = UIColor.white label2.text = "Label2" label2.verticalPadding = 10 label2.horizontalPadding = 10 - label2.backgroundColor = UIColor.black - label2.textColor = UIColor.white label3.verticalPadding = 10 label3.horizontalPadding = 10 - label3.backgroundColor = UIColor.black - label3.textColor = UIColor.white stackView.axis = .horizontal stackView.spacing = 8 @@ -47,6 +41,13 @@ class CardPartPillLabelCardController: CardPartsViewController { stackView.layoutMargins = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10) [label1, label2, label3].forEach { label in + if #available(iOS 13.0, *) { + label.backgroundColor = .tertiarySystemFill + label.textColor = .label + } else { + label.backgroundColor = UIColor.black + label.textColor = UIColor.white + } stackView.addArrangedSubview(label) } diff --git a/Example/CardParts/CardPartProgressBarViewCardController.swift b/Example/CardParts/CardPartProgressBarViewCardController.swift index cb13c39b..a94abbfa 100644 --- a/Example/CardParts/CardPartProgressBarViewCardController.swift +++ b/Example/CardParts/CardPartProgressBarViewCardController.swift @@ -15,11 +15,11 @@ class CardPartProgressBarViewCardController: CardPartsViewController { var viewModel = ReactiveCardPartProgressBarViewModel() - let barColors: [UIColor] = [UIColor.red, - UIColor.green, - UIColor.yellow, - UIColor.purple, - UIColor.blue] + let barColors: [UIColor] = [UIColor.systemRed, + UIColor.systemGreen, + UIColor.systemYellow, + UIColor.systemPurple, + UIColor.systemBlue] override func viewDidLoad() { let progressBarView = CardPartProgressBarView(barColors: barColors, marker: nil, markerLabelTitle: "", currentValue: 2, showShowBarValues: false) diff --git a/Example/CardParts/CardPartRadioButtonCardController.swift b/Example/CardParts/CardPartRadioButtonCardController.swift index b19b463e..53adf96f 100644 --- a/Example/CardParts/CardPartRadioButtonCardController.swift +++ b/Example/CardParts/CardPartRadioButtonCardController.swift @@ -29,14 +29,14 @@ class CardPartRadioButtonCardController : CardPartsViewController { let radioButton1 = CardPartRadioButton() - radioButton1.outerCircleColor = UIColor.red + radioButton1.outerCircleColor = UIColor.systemRed radioButton1.outerCircleLineWidth = 2.0 radioButton1.tag = 1 radioButton1.isSelected = false radioButton1.widthAnchor.constraint(equalToConstant: 20).isActive = true radioButton1.heightAnchor.constraint(equalToConstant: 20).isActive = true - firstLabel.textColor = UIColor.red + firstLabel.textColor = UIColor.systemRed firstLabel.text = "Not Selected" [radioButton1, firstLabel].forEach { component in @@ -57,14 +57,14 @@ class CardPartRadioButtonCardController : CardPartsViewController { secondRowStackView.layoutMargins = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10) let radioButton2 = CardPartRadioButton() - radioButton2.outerCircleColor = UIColor.orange + radioButton2.outerCircleColor = UIColor.systemOrange radioButton2.outerCircleLineWidth = 2.0 radioButton2.tag = 2 radioButton2.isSelected = true radioButton2.widthAnchor.constraint(equalToConstant: 20).isActive = true radioButton2.heightAnchor.constraint(equalToConstant: 20).isActive = true - secondLabel.textColor = UIColor.orange + secondLabel.textColor = UIColor.systemOrange secondLabel.text = "Selected" [radioButton2, secondLabel].forEach { component in diff --git a/Example/CardParts/CardPartRoundedStackViewCardController.swift b/Example/CardParts/CardPartRoundedStackViewCardController.swift index c1bd1d84..c6d7067a 100644 --- a/Example/CardParts/CardPartRoundedStackViewCardController.swift +++ b/Example/CardParts/CardPartRoundedStackViewCardController.swift @@ -18,7 +18,8 @@ class CardPartRoundedStackViewCardController: CardPartsViewController { let textView = CardPartTextView(type: .title) textView.text = "Card Parts" - let cardPartsImage = CardPartImageView(image: UIImage(named: "cardIcon")) + let icon = UIImage(named: "cardIcon")?.withRenderingMode(.alwaysTemplate) + let cardPartsImage = CardPartImageView(image: icon) cardPartsImage.contentMode = .scaleAspectFit let roundedStackView = CardPartStackView() @@ -29,9 +30,22 @@ class CardPartRoundedStackViewCardController: CardPartsViewController { roundedStackView.isLayoutMarginsRelativeArrangement = true roundedStackView.layoutMargins = UIEdgeInsets(top: 10, left: 20, bottom: 10, right: 20) roundedStackView.cornerRadius = 10.0 - roundedStackView.backgroundView.backgroundColor = UIColor(red: 16.0 / 255.0, green: 128.0 / 255.0, blue: 0, alpha: 0.16) roundedStackView.pinBackground(roundedStackView.backgroundView, to: roundedStackView) + + if #available(iOS 13.0, *) { + cardPartsImage.tintColor = .label + roundedStackView.backgroundView.backgroundColor = UIColor(dynamicProvider: { traitCollection in + if traitCollection.userInterfaceStyle == .dark { + return UIColor(red: 27.0 / 255.0, green: 223.0 / 255.0, blue: 0, alpha: 0.16) + } + return UIColor(red: 16.0 / 255.0, green: 128.0 / 255.0, blue: 0, alpha: 0.16) + }) + } else { + cardPartsImage.tintColor = .black + roundedStackView.backgroundView.backgroundColor = UIColor(red: 16.0 / 255.0, green: 128.0 / 255.0, blue: 0, alpha: 0.16) + } + roundedStackView.addArrangedSubview(textView) roundedStackView.addArrangedSubview(cardPartsImage) diff --git a/Example/CardParts/CardPartStackViewCardController.swift b/Example/CardParts/CardPartStackViewCardController.swift index 03cb592a..c264c59f 100644 --- a/Example/CardParts/CardPartStackViewCardController.swift +++ b/Example/CardParts/CardPartStackViewCardController.swift @@ -21,22 +21,22 @@ class CardPartStackViewCardController: CardPartsViewController { let cardPartTextView1 = CardPartTextView(type: .normal) cardPartTextView1.text = "This" - cardPartTextView1.textColor = .purple + cardPartTextView1.textColor = .systemPurple cardPartSV.addArrangedSubview(cardPartTextView1) let cardPartTextView2 = CardPartTextView(type: .normal) cardPartTextView2.text = "is" - cardPartTextView2.textColor = .blue + cardPartTextView2.textColor = .systemBlue cardPartSV.addArrangedSubview(cardPartTextView2) let cardPartTextView3 = CardPartTextView(type: .normal) cardPartTextView3.text = "a" - cardPartTextView3.textColor = .orange + cardPartTextView3.textColor = .systemOrange cardPartSV.addArrangedSubview(cardPartTextView3) let cardPartTextView4 = CardPartTextView(type: .normal) cardPartTextView4.text = "CardPartStackView" - cardPartTextView4.textColor = .red + cardPartTextView4.textColor = .systemRed cardPartSV.addArrangedSubview(cardPartTextView4) setupCardParts([cardPartSV]) diff --git a/Example/CardParts/MainViewController.swift b/Example/CardParts/MainViewController.swift index 95f326f4..afcdd53a 100644 --- a/Example/CardParts/MainViewController.swift +++ b/Example/CardParts/MainViewController.swift @@ -12,7 +12,9 @@ import CardParts class MainViewController: CardsViewController { required init?(coder: NSCoder) { - CardPartsMintTheme().apply() + // Override point for customization after application launch. + // Uncomment the following to try use our custom theme. +// CardPartsCustomTheme().apply() super.init(coder: coder) } diff --git a/Example/CardParts/ThemedCardController.swift b/Example/CardParts/ThemedCardController.swift index dd6fdb86..b3003db0 100644 --- a/Example/CardParts/ThemedCardController.swift +++ b/Example/CardParts/ThemedCardController.swift @@ -54,8 +54,11 @@ extension ThemedCardController: ShadowCardTrait { return CGSize(width: 1.0, height: 1.0) } - func shadowColor() -> CGColor { - return UIColor.lightGray.cgColor + func shadowColor() -> UIColor { + if #available(iOS 13.0, *) { + return UIColor.systemGray6 + } + return UIColor.lightGray } func shadowRadius() -> CGFloat { diff --git a/Example/Tests/CardPartTableViewCellTests.swift b/Example/Tests/CardPartTableViewCellTests.swift index 71b8b5a4..d10438c2 100644 --- a/Example/Tests/CardPartTableViewCellTests.swift +++ b/Example/Tests/CardPartTableViewCellTests.swift @@ -91,10 +91,10 @@ class CardPartTableViewCellTests: XCTestCase { cell.leftTitleColor = UIColor.red cell.displayAsHidden = true - XCTAssertEqual(cell.leftTitleLabel.textColor, UIColor.Gray2) - XCTAssertEqual(cell.rightTitleLabel.textColor, UIColor.Gray2) - XCTAssertEqual(cell.leftDescriptionLabel.textColor, UIColor.Gray2) - XCTAssertEqual(cell.rightDescriptionLabel.textColor, UIColor.Gray2) + XCTAssertEqual(cell.leftTitleLabel.textColor, UIColor.SystemGray2) + XCTAssertEqual(cell.rightTitleLabel.textColor, UIColor.SystemGray2) + XCTAssertEqual(cell.leftDescriptionLabel.textColor, UIColor.SystemGray2) + XCTAssertEqual(cell.rightDescriptionLabel.textColor, UIColor.SystemGray2) cell.displayAsHidden = false XCTAssertEqual(cell.leftTitleLabel.textColor, UIColor.red) diff --git a/README.md b/README.md index b419e3e9..44968dfb 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ CardParts - made with ❤️ by Intuit: - [Themes](#themes) - [Clickable Cards](#clickable-cards) - [Listeners](#listeners) +- [Dark Mode](#dark-mode) - [Apps That Love CardParts](#apps-that-love-cardparts) - [Publications](#publications) - [License](#license) @@ -232,7 +233,7 @@ class MyCardsViewController: CardsViewController { super.init(nibName: nil, bundle: nil) self.cardCellMargins = UIEdgeInsets(/* custom card margins */) } - + ... } ``` @@ -387,7 +388,7 @@ Use this protocol to specifiy a custom margin for the card, implement `customMar ## `CardPartsViewController` -CardPartsViewController implements the CardController protocol and builds its card UI by displaying one or more card part views using an MVVM pattern that includes automatic data binding. Each CardPartsViewController displays a list of CardPartView as its subviews. Each CardPartView renders as a row in the card. The CardParts framework implements several different types of CardPartView that display basic views, such as title, text, image, button, separator, etc. All CardPartView implemented by the framework are already styled to correctly match the applied +CardPartsViewController implements the CardController protocol and builds its card UI by displaying one or more card part views using an MVVM pattern that includes automatic data binding. Each CardPartsViewController displays a list of CardPartView as its subviews. Each CardPartView renders as a row in the card. The CardParts framework implements several different types of CardPartView that display basic views, such as title, text, image, button, separator, etc. All CardPartView implemented by the framework are already styled to correctly match the applied s UI guidelines. In addition to the card parts, a CardPartsViewController also uses a view model to expose data properties that are bound to the card parts. The view model should contain all the business logic for the card, thus keeping the role of the CardPartsViewController to just creating its view parts and setting up bindings from the view model to the card parts. A simple implementation of a CardPartsViewController based card might look like the following: @@ -564,7 +565,7 @@ let centerAligned = CardPartTitleDescriptionView(titlePosition: .top, secondaryP #### `CardPartPillLabel` -CardPartPillLabel provides you the rounded corners, text aligned being at the center along with vertical and horizontal padding capability. +CardPartPillLabel provides you the rounded corners, text aligned being at the center along with vertical and horizontal padding capability. ```swift var verticalPadding:CGFloat @@ -622,6 +623,7 @@ let roundedStackView = CardPartStackView() roundedStackView.cornerRadius = 10.0 roundedStackView.pinBackground(roundedStackView.backgroundView, to: roundedStackView) ``` +

roundedStackView

@@ -987,7 +989,7 @@ A `CardPartCenteredView` can take in any card part that conforms to `CardPartVie #### `CardPartConfettiView` -Provides the capability to add confetti with various types ( diamonds, star, mixed ) and colors, along with different level of intensity +Provides the capability to add confetti with various types ( diamonds, star, mixed ) and colors, along with different level of intensity ```swift let confettiView = CardPartConfettiView() @@ -1037,13 +1039,13 @@ Here's a small example of how to reactively set the location from a changing add ### `CardPartRadioButton` -Provides the capability to add radio buttons with configurable inner/outer circle line width , colors along with tap etc.. +Provides the capability to add radio buttons with configurable inner/outer circle line width , colors along with tap etc.. ```swift let radioButton = CardPartRadioButton() radioButton.outerCircleColor = UIColor.orange radioButton.outerCircleLineWidth = 2.0 - + radioButton2.rx.tap.subscribe(onNext: { print("Radio Button Tapped") }).disposed(by: bag) @@ -1275,6 +1277,14 @@ extension MYOwnCardPartController: CardPartsLongPressGestureRecognizerDelegate { } ``` +# Dark Mode + +CardParts now supports iOS 13's Dark Mode! + +

+darkmode +

+ # Apps That Love CardParts - [Mint - Personal Finance & Money](https://itunes.apple.com/us/app/mint-personal-finance-money/id300238550?mt=8) diff --git a/images/darkmode.png b/images/darkmode.png new file mode 100644 index 00000000..c30671a2 Binary files /dev/null and b/images/darkmode.png differ