diff --git a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift index 598f3f4e..087e893c 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift @@ -677,9 +677,6 @@ public typealias ActionBlock = () -> () @objc public func updateView(_ size: CGFloat) { scaleSize = size as NSNumber - // This fixes a defect for when there are multiple labels stacked in a list item. Sometime some labels will not fill their available space. - preferredMaxLayoutWidth = size - if let originalAttributedString = originalAttributedString { let attributedString = NSMutableAttributedString(attributedString: originalAttributedString) attributedString.removeAttribute(.font, range: NSRange(location: 0, length: attributedString.length)) diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift index e7a35cc6..d623311b 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableNumberedListAllTextAndLinks.swift @@ -21,7 +21,7 @@ import Foundation //-------------------------------------------------- public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { stack = Stack.createStack(with: [(view: leftLabel, model: StackItemModel(horizontalAlignment: .fill)), - (view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading))], + (view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .fill))], axis: .horizontal) super.init(style: style, reuseIdentifier: reuseIdentifier) } @@ -35,6 +35,7 @@ import Foundation //-------------------------------------------------- override open func setupView() { super.setupView() + leftLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal) addMolecule(stack) stack.restack() } @@ -57,4 +58,10 @@ import Foundation super.reset() leftLabel.styleTitle2XLarge(true) } + + open override func layoutSubviews() { + super.layoutSubviews() + // This fixes a defect body text where it doesn't layout correctly. + eyebrowHeadlineBodyLink.body.preferredMaxLayoutWidth = eyebrowHeadlineBodyLink.frame.width + } } diff --git a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift index dc8b9cae..8a6cb82d 100644 --- a/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/Tabs.swift @@ -155,8 +155,8 @@ import UIKit super.set(with: model, delegateObject, additionalData) self.delegateObject = delegateObject self.additionalData = additionalData - self.selectedIndex = tabsModel?.selectedIndex ?? 0 - self.bottomLine.backgroundColor = tabsModel?.selectedColor.uiColor + selectedIndex = tabsModel?.selectedIndex ?? 0 + bottomLine.backgroundColor = tabsModel?.selectedColor.uiColor reloadData() } } @@ -236,13 +236,13 @@ extension Tabs: UICollectionViewDelegateFlowLayout { collect.selectItem(at: indexPath, animated: animated, scrollPosition: .centeredHorizontally) guard let tabCell = collect.cellForItem(at: indexPath) as? TabItemCell, let tabsModel = self.tabsModel else { return } - self.moveBottomLine(toIndex: indexPath, animated: animated, cell: tabCell) + moveBottomLine(toIndex: indexPath, animated: animated, cell: tabCell) tabCell.label.textColor = tabsModel.selectedColor.uiColor tabCell.updateAccessibility(indexPath: indexPath, selected: true, tabsModel: tabsModel) tabCell.setNeedsDisplay() tabCell.setNeedsLayout() tabCell.layoutIfNeeded() - self.delegate?.didSelectItem(indexPath, tabs: self) + delegate?.didSelectItem(indexPath, tabs: self) } } diff --git a/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift b/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift index 38dee0d2..41a35182 100644 --- a/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/NavigationBar/NavigationItemModel.swift @@ -16,7 +16,6 @@ public class NavigationItemModel: NavigationItemModelProtocol, PanelNavigationIt public var title: String? public var hidden: Bool public var backgroundColor: Color? - public var translucent: Bool public var tintColor: Color public var line: LineModel? public var backButton: NavigationItemButtonModel? @@ -29,7 +28,6 @@ public class NavigationItemModel: NavigationItemModelProtocol, PanelNavigationIt public init() { hidden = false - translucent = false backgroundColor = Color(uiColor: .white) tintColor = Color(uiColor: .black) line = LineModel(type: .standard) @@ -42,7 +40,6 @@ public class NavigationItemModel: NavigationItemModelProtocol, PanelNavigationIt case title case hidden case backgroundColor - case translucent case tintColor case line case backButton @@ -57,7 +54,6 @@ public class NavigationItemModel: NavigationItemModelProtocol, PanelNavigationIt title = try typeContainer.decodeIfPresent(String.self, forKey: .title) hidden = try typeContainer.decodeIfPresent(Bool.self, forKey: .hidden) ?? false backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) ?? Color(uiColor: .white) - translucent = try typeContainer.decodeIfPresent(Bool.self, forKey: .translucent) ?? false tintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .tintColor) ?? Color(uiColor: .black) line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) backButton = try typeContainer.decodeIfPresent(NavigationItemButtonModel.self, forKey: .backButton) ?? NavigationItemButtonModel(with: "back", action: ActionBackModel()) @@ -72,7 +68,6 @@ public class NavigationItemModel: NavigationItemModelProtocol, PanelNavigationIt try container.encodeIfPresent(title, forKey: .title) try container.encode(hidden, forKey: .hidden) try container.encode(backgroundColor, forKey: .backgroundColor) - try container.encode(translucent, forKey: .translucent) try container.encode(tintColor, forKey: .tintColor) try container.encodeIfPresent(line, forKey: .line) try container.encodeIfPresent(backButton, forKey: .backButton) diff --git a/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift b/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift index 634539d4..0bd192e3 100644 --- a/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/ModelProtocols/NavigationItemModelProtocol.swift @@ -12,7 +12,6 @@ public protocol NavigationItemModelProtocol { var title: String? { get set } var hidden: Bool { get set } var backgroundColor: Color? { get set } - var translucent: Bool { get set } var tintColor: Color { get set } var line: LineModel? { get set } var backButton: NavigationItemButtonModel? { get set } diff --git a/MVMCoreUI/Categories/UIColor+Extension.swift b/MVMCoreUI/Categories/UIColor+Extension.swift index 1ef2e217..78be926d 100644 --- a/MVMCoreUI/Categories/UIColor+Extension.swift +++ b/MVMCoreUI/Categories/UIColor+Extension.swift @@ -269,31 +269,6 @@ extension UIColor { return .white } - public class func setBackgroundColor(_ color: UIColor, for navigationBar: UINavigationBar, isTransparent: Bool) { - - DispatchQueue.main.async { - - let view = UIView(frame: CGRect(x: 0, y: 0, width: 1, height: 1)) - view.backgroundColor = color - - UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.isOpaque, 0.0) - - if let context = UIGraphicsGetCurrentContext() { - view.layer.render(in: context) - } - - let image = UIGraphicsGetImageFromCurrentImageContext() - UIGraphicsEndImageContext() - - if isTransparent { - navigationBar.setBackgroundImage(UIImage(), for: .default) - navigationBar.isTranslucent = false - } else { - navigationBar.setBackgroundImage(image, for: .default) - } - } - } - /// - parameter color: The UIColor intended to retrieve its hex value. public class func hexString(for color: UIColor) -> String? { diff --git a/MVMCoreUI/Categories/UIColor+MFConvenience.h b/MVMCoreUI/Categories/UIColor+MFConvenience.h index 92b28a36..97280ba1 100644 --- a/MVMCoreUI/Categories/UIColor+MFConvenience.h +++ b/MVMCoreUI/Categories/UIColor+MFConvenience.h @@ -183,9 +183,6 @@ // Returns a gradient lighter color; + (nonnull UIColor *)mfGradientColor:(nullable UIColor *)color; -// Sets the background color for the nav bar. -+ (void)mfSetBackgroundColorForNavigationBar:(nonnull UIColor *)color navigationBar:(nonnull UINavigationBar *)navigationBar transparent:(BOOL)transparent; - #pragma mark - Hex String + (nullable NSString *)hexStringForColor:(nonnull UIColor*)color; diff --git a/MVMCoreUI/Categories/UIColor+MFConvenience.m b/MVMCoreUI/Categories/UIColor+MFConvenience.m index 33df3848..8786df01 100644 --- a/MVMCoreUI/Categories/UIColor+MFConvenience.m +++ b/MVMCoreUI/Categories/UIColor+MFConvenience.m @@ -389,27 +389,6 @@ return [UIColor whiteColor]; } - -+ (void)mfSetBackgroundColorForNavigationBar:(nonnull UIColor *)color navigationBar:(nonnull UINavigationBar *)navigationBar transparent:(BOOL)transparent { - - [MVMCoreDispatchUtility performBlockOnMainThread:^{ - UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)]; - view.backgroundColor = color; - UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0); - [view.layer renderInContext:UIGraphicsGetCurrentContext()]; - UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - if (transparent) { - [navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; - [navigationBar setTranslucent:NO]; - - } else { - [navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault]; - - } - }]; -} - #pragma mark - Hex String + (nullable NSString *)hexStringForColor:(nonnull UIColor*)color { diff --git a/MVMCoreUI/Containers/NavigationController.swift b/MVMCoreUI/Containers/NavigationController.swift index 3f7846a0..4367f2e1 100644 --- a/MVMCoreUI/Containers/NavigationController.swift +++ b/MVMCoreUI/Containers/NavigationController.swift @@ -18,7 +18,7 @@ import UIKit /// Provides MVM styling to the navigation bar. Returns a reference to the line. public static func style(_ navigationBar: UINavigationBar) -> Line { - UIColor.mfSetBackgroundColor(forNavigationBar: .white, navigationBar: navigationBar, transparent: false) + navigationBar.backgroundColor = .white navigationBar.shadowImage = UIImage() navigationBar.isOpaque = true navigationBar.tintColor = .black @@ -72,7 +72,7 @@ import UIKit viewController.navigationItem.hidesBackButton = (navigationItemModel.backButton != nil) navigationController.setNavigationBarHidden(navigationItemModel.hidden, animated: true) - UIColor.setBackgroundColor(navigationItemModel.backgroundColor?.uiColor ?? .white, for: navigationController.navigationBar, isTransparent: navigationItemModel.translucent) + navigationController.navigationBar.barTintColor = navigationItemModel.backgroundColor?.uiColor ?? .white let tint = navigationItemModel.tintColor.uiColor navigationController.navigationBar.tintColor = tint