Merge branch 'develop' into feature/more_inversion
This commit is contained in:
commit
3ab8969b1b
@ -402,11 +402,11 @@ public typealias ActionBlock = () -> ()
|
|||||||
attributedString.insert(mutableString, at: imageAtt.location)
|
attributedString.insert(mutableString, at: imageAtt.location)
|
||||||
|
|
||||||
case let fontAtt as LabelAttributeFontModel:
|
case let fontAtt as LabelAttributeFontModel:
|
||||||
if let fontStyle = fontAtt.style?.rawValue {
|
if let fontStyle = fontAtt.style {
|
||||||
let styles = MFStyler.styleGetAttributedString("0", withStyle: fontStyle)
|
|
||||||
attributedString.removeAttribute(.font, range: range)
|
attributedString.removeAttribute(.font, range: range)
|
||||||
attributedString.removeAttribute(.foregroundColor, range: range)
|
attributedString.removeAttribute(.foregroundColor, range: range)
|
||||||
attributedString.addAttributes(styles.attributes(at: 0, effectiveRange: nil), range: range)
|
attributedString.addAttribute(.font, value: fontStyle.getFont(), range: range)
|
||||||
|
attributedString.addAttribute(.foregroundColor, value: fontStyle.color(), range: range)
|
||||||
} else {
|
} else {
|
||||||
let fontSize = fontAtt.size
|
let fontSize = fontAtt.size
|
||||||
var font: UIFont?
|
var font: UIFont?
|
||||||
@ -677,9 +677,6 @@ public typealias ActionBlock = () -> ()
|
|||||||
@objc public func updateView(_ size: CGFloat) {
|
@objc public func updateView(_ size: CGFloat) {
|
||||||
scaleSize = size as NSNumber
|
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 {
|
if let originalAttributedString = originalAttributedString {
|
||||||
let attributedString = NSMutableAttributedString(attributedString: originalAttributedString)
|
let attributedString = NSMutableAttributedString(attributedString: originalAttributedString)
|
||||||
attributedString.removeAttribute(.font, range: NSRange(location: 0, length: attributedString.length))
|
attributedString.removeAttribute(.font, range: NSRange(location: 0, length: attributedString.length))
|
||||||
|
|||||||
@ -21,7 +21,7 @@ import Foundation
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
stack = Stack<StackModel>.createStack(with: [(view: leftLabel, model: StackItemModel(horizontalAlignment: .fill)),
|
stack = Stack<StackModel>.createStack(with: [(view: leftLabel, model: StackItemModel(horizontalAlignment: .fill)),
|
||||||
(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading))],
|
(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .fill))],
|
||||||
axis: .horizontal)
|
axis: .horizontal)
|
||||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||||
}
|
}
|
||||||
@ -35,6 +35,7 @@ import Foundation
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
|
leftLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
}
|
}
|
||||||
@ -57,4 +58,10 @@ import Foundation
|
|||||||
super.reset()
|
super.reset()
|
||||||
leftLabel.styleTitle2XLarge(true)
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -155,8 +155,8 @@ import UIKit
|
|||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
self.delegateObject = delegateObject
|
self.delegateObject = delegateObject
|
||||||
self.additionalData = additionalData
|
self.additionalData = additionalData
|
||||||
self.selectedIndex = tabsModel?.selectedIndex ?? 0
|
selectedIndex = tabsModel?.selectedIndex ?? 0
|
||||||
self.bottomLine.backgroundColor = tabsModel?.selectedColor.uiColor
|
bottomLine.backgroundColor = tabsModel?.selectedColor.uiColor
|
||||||
reloadData()
|
reloadData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -236,13 +236,13 @@ extension Tabs: UICollectionViewDelegateFlowLayout {
|
|||||||
|
|
||||||
collect.selectItem(at: indexPath, animated: animated, scrollPosition: .centeredHorizontally)
|
collect.selectItem(at: indexPath, animated: animated, scrollPosition: .centeredHorizontally)
|
||||||
guard let tabCell = collect.cellForItem(at: indexPath) as? TabItemCell, let tabsModel = self.tabsModel else { return }
|
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.label.textColor = tabsModel.selectedColor.uiColor
|
||||||
tabCell.updateAccessibility(indexPath: indexPath, selected: true, tabsModel: tabsModel)
|
tabCell.updateAccessibility(indexPath: indexPath, selected: true, tabsModel: tabsModel)
|
||||||
tabCell.setNeedsDisplay()
|
tabCell.setNeedsDisplay()
|
||||||
tabCell.setNeedsLayout()
|
tabCell.setNeedsLayout()
|
||||||
tabCell.layoutIfNeeded()
|
tabCell.layoutIfNeeded()
|
||||||
self.delegate?.didSelectItem(indexPath, tabs: self)
|
delegate?.didSelectItem(indexPath, tabs: self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,7 @@ open class MoleculeCollectionViewCell: CollectionViewCell {
|
|||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let collectionModel = model as? MoleculeCollectionItemModel else { return }
|
guard let collectionModel = model as? MoleculeCollectionItemModel else { return }
|
||||||
|
|
||||||
if molecule == nil {
|
if molecule == nil {
|
||||||
if let moleculeView = MoleculeObjectMapping.shared()?.createMolecule(collectionModel.molecule, delegateObject: delegateObject, additionalData: additionalData) {
|
if let moleculeView = MoleculeObjectMapping.shared()?.createMolecule(collectionModel.molecule, delegateObject: delegateObject, additionalData: additionalData) {
|
||||||
addMolecule(moleculeView)
|
addMolecule(moleculeView)
|
||||||
@ -24,13 +25,12 @@ open class MoleculeCollectionViewCell: CollectionViewCell {
|
|||||||
|
|
||||||
guard let molecule = molecule as? (UIView & MVMCoreUIViewConstrainingProtocol) else { return }
|
guard let molecule = molecule as? (UIView & MVMCoreUIViewConstrainingProtocol) else { return }
|
||||||
containerHelper.set(with: collectionModel, for: molecule)
|
containerHelper.set(with: collectionModel, for: molecule)
|
||||||
accessibilityElements = molecule.subviews
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
molecule?.reset()
|
molecule?.reset()
|
||||||
backgroundColor = .white
|
backgroundColor = .mvmWhite
|
||||||
}
|
}
|
||||||
|
|
||||||
open class func nameForReuse(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
open class func nameForReuse(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||||
|
|||||||
@ -16,7 +16,6 @@ public class NavigationItemModel: NavigationItemModelProtocol, PanelNavigationIt
|
|||||||
public var title: String?
|
public var title: String?
|
||||||
public var hidden: Bool
|
public var hidden: Bool
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var translucent: Bool
|
|
||||||
public var tintColor: Color
|
public var tintColor: Color
|
||||||
public var line: LineModel?
|
public var line: LineModel?
|
||||||
public var backButton: NavigationItemButtonModel?
|
public var backButton: NavigationItemButtonModel?
|
||||||
@ -29,7 +28,6 @@ public class NavigationItemModel: NavigationItemModelProtocol, PanelNavigationIt
|
|||||||
|
|
||||||
public init() {
|
public init() {
|
||||||
hidden = false
|
hidden = false
|
||||||
translucent = false
|
|
||||||
backgroundColor = Color(uiColor: .white)
|
backgroundColor = Color(uiColor: .white)
|
||||||
tintColor = Color(uiColor: .black)
|
tintColor = Color(uiColor: .black)
|
||||||
line = LineModel(type: .standard)
|
line = LineModel(type: .standard)
|
||||||
@ -42,7 +40,6 @@ public class NavigationItemModel: NavigationItemModelProtocol, PanelNavigationIt
|
|||||||
case title
|
case title
|
||||||
case hidden
|
case hidden
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
case translucent
|
|
||||||
case tintColor
|
case tintColor
|
||||||
case line
|
case line
|
||||||
case backButton
|
case backButton
|
||||||
@ -57,7 +54,6 @@ public class NavigationItemModel: NavigationItemModelProtocol, PanelNavigationIt
|
|||||||
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
|
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
|
||||||
hidden = try typeContainer.decodeIfPresent(Bool.self, forKey: .hidden) ?? false
|
hidden = try typeContainer.decodeIfPresent(Bool.self, forKey: .hidden) ?? false
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) ?? Color(uiColor: .white)
|
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)
|
tintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .tintColor) ?? Color(uiColor: .black)
|
||||||
line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line)
|
line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line)
|
||||||
backButton = try typeContainer.decodeIfPresent(NavigationItemButtonModel.self, forKey: .backButton) ?? NavigationItemButtonModel(with: "back", action: ActionBackModel())
|
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.encodeIfPresent(title, forKey: .title)
|
||||||
try container.encode(hidden, forKey: .hidden)
|
try container.encode(hidden, forKey: .hidden)
|
||||||
try container.encode(backgroundColor, forKey: .backgroundColor)
|
try container.encode(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encode(translucent, forKey: .translucent)
|
|
||||||
try container.encode(tintColor, forKey: .tintColor)
|
try container.encode(tintColor, forKey: .tintColor)
|
||||||
try container.encodeIfPresent(line, forKey: .line)
|
try container.encodeIfPresent(line, forKey: .line)
|
||||||
try container.encodeIfPresent(backButton, forKey: .backButton)
|
try container.encodeIfPresent(backButton, forKey: .backButton)
|
||||||
|
|||||||
@ -12,7 +12,6 @@ public protocol NavigationItemModelProtocol {
|
|||||||
var title: String? { get set }
|
var title: String? { get set }
|
||||||
var hidden: Bool { get set }
|
var hidden: Bool { get set }
|
||||||
var backgroundColor: Color? { get set }
|
var backgroundColor: Color? { get set }
|
||||||
var translucent: Bool { get set }
|
|
||||||
var tintColor: Color { get set }
|
var tintColor: Color { get set }
|
||||||
var line: LineModel? { get set }
|
var line: LineModel? { get set }
|
||||||
var backButton: NavigationItemButtonModel? { get set }
|
var backButton: NavigationItemButtonModel? { get set }
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
|
||||||
open class ModalMoleculeListTemplate: MoleculeListTemplate {
|
open class ModalMoleculeListTemplate: MoleculeListTemplate {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
@ -15,13 +16,20 @@ open class ModalMoleculeListTemplate: MoleculeListTemplate {
|
|||||||
|
|
||||||
public var closeButton: Button?
|
public var closeButton: Button?
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Lifecycle
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
override open func handleNewData() {
|
override open func handleNewData() {
|
||||||
super.handleNewData()
|
super.handleNewData()
|
||||||
|
|
||||||
closeButton = MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: { _ in
|
closeButton = MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: { _ in
|
||||||
MVMCoreNavigationHandler.shared()?.removeCurrentViewController()
|
MVMCoreNavigationHandler.shared()?.removeCurrentViewController()
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func viewDidLayoutSubviews() {
|
||||||
|
super.viewDidLayoutSubviews()
|
||||||
accessibilityElements = [closeButton as Any, tableView as Any]
|
accessibilityElements = [closeButton as Any, tableView as Any]
|
||||||
UIAccessibility.post(notification: .layoutChanged, argument: closeButton)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
|
||||||
open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol {
|
open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Stored Properties
|
// MARK: - Stored Properties
|
||||||
|
|||||||
@ -8,8 +8,12 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
/// A base collection view cell with basic mvm functionality.
|
/// A base collection view cell with basic mvm functionality.
|
||||||
open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCoreViewProtocol, CollectionTemplateItemProtocol {
|
open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCoreViewProtocol, CollectionTemplateItemProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
// Convenience helpers
|
// Convenience helpers
|
||||||
open var molecule: MoleculeViewProtocol?
|
open var molecule: MoleculeViewProtocol?
|
||||||
@ -21,6 +25,10 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo
|
|||||||
|
|
||||||
private var initialSetupPerformed = false
|
private var initialSetupPerformed = false
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
// MARK: - Inits
|
// MARK: - Inits
|
||||||
public override init(frame: CGRect) {
|
public override init(frame: CGRect) {
|
||||||
super.init(frame: .zero)
|
super.init(frame: .zero)
|
||||||
@ -39,6 +47,10 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
open func setupView() {
|
open func setupView() {
|
||||||
isAccessibilityElement = false
|
isAccessibilityElement = false
|
||||||
@ -58,10 +70,14 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo
|
|||||||
|
|
||||||
open func reset() {
|
open func reset() {
|
||||||
molecule?.reset()
|
molecule?.reset()
|
||||||
backgroundColor = .white
|
backgroundColor = .mvmWhite
|
||||||
width = nil
|
width = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
// MARK: - MoleculeViewProtocol
|
// MARK: - MoleculeViewProtocol
|
||||||
open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
guard let model = model as? CollectionItemModelProtocol else { return }
|
guard let model = model as? CollectionItemModelProtocol else { return }
|
||||||
@ -85,7 +101,10 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo
|
|||||||
self.molecule = molecule
|
self.molecule = molecule
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
// MARK: - CollectionTemplateItemProtocol
|
// MARK: - CollectionTemplateItemProtocol
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func set(width: CGFloat) {
|
public func set(width: CGFloat) {
|
||||||
self.width = width
|
self.width = width
|
||||||
}
|
}
|
||||||
@ -96,7 +115,7 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo
|
|||||||
guard let width = width else { return autoLayoutAttributes }
|
guard let width = width else { return autoLayoutAttributes }
|
||||||
|
|
||||||
let targetSize = CGSize(width: width, height: 0)
|
let targetSize = CGSize(width: width, height: 0)
|
||||||
let newSize = contentView.systemLayoutSizeFitting(targetSize, withHorizontalFittingPriority: UILayoutPriority.required, verticalFittingPriority: UILayoutPriority.defaultLow)
|
let newSize = contentView.systemLayoutSizeFitting(targetSize, withHorizontalFittingPriority: .required, verticalFittingPriority: .defaultLow)
|
||||||
let newFrame = CGRect(origin: autoLayoutAttributes.frame.origin, size: newSize)
|
let newFrame = CGRect(origin: autoLayoutAttributes.frame.origin, size: newSize)
|
||||||
autoLayoutAttributes.frame = newFrame
|
autoLayoutAttributes.frame = newFrame
|
||||||
return autoLayoutAttributes
|
return autoLayoutAttributes
|
||||||
|
|||||||
@ -206,7 +206,6 @@ import UIKit
|
|||||||
caret.translatesAutoresizingMaskIntoConstraints = true
|
caret.translatesAutoresizingMaskIntoConstraints = true
|
||||||
caret.isAccessibilityElement = true
|
caret.isAccessibilityElement = true
|
||||||
caret.accessibilityTraits = .button
|
caret.accessibilityTraits = .button
|
||||||
caret.accessibilityLabel = "Caret,"
|
|
||||||
caret.accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccTabHint")
|
caret.accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccTabHint")
|
||||||
caret.size = .small(.vertical)
|
caret.size = .small(.vertical)
|
||||||
if let size = caret.size?.dimensions() {
|
if let size = caret.size?.dimensions() {
|
||||||
|
|||||||
@ -277,31 +277,6 @@ extension UIColor {
|
|||||||
return .white
|
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.
|
/// - parameter color: The UIColor intended to retrieve its hex value.
|
||||||
public class func hexString(for color: UIColor) -> String? {
|
public class func hexString(for color: UIColor) -> String? {
|
||||||
|
|
||||||
|
|||||||
@ -183,9 +183,6 @@
|
|||||||
// Returns a gradient lighter color;
|
// Returns a gradient lighter color;
|
||||||
+ (nonnull UIColor *)mfGradientColor:(nullable UIColor *)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
|
#pragma mark - Hex String
|
||||||
|
|
||||||
+ (nullable NSString *)hexStringForColor:(nonnull UIColor*)color;
|
+ (nullable NSString *)hexStringForColor:(nonnull UIColor*)color;
|
||||||
|
|||||||
@ -389,27 +389,6 @@
|
|||||||
return [UIColor whiteColor];
|
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
|
#pragma mark - Hex String
|
||||||
|
|
||||||
+ (nullable NSString *)hexStringForColor:(nonnull UIColor*)color {
|
+ (nullable NSString *)hexStringForColor:(nonnull UIColor*)color {
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import UIKit
|
|||||||
|
|
||||||
/// Provides MVM styling to the navigation bar. Returns a reference to the line.
|
/// Provides MVM styling to the navigation bar. Returns a reference to the line.
|
||||||
public static func style(_ navigationBar: UINavigationBar) -> Line {
|
public static func style(_ navigationBar: UINavigationBar) -> Line {
|
||||||
UIColor.mfSetBackgroundColor(forNavigationBar: .white, navigationBar: navigationBar, transparent: false)
|
navigationBar.backgroundColor = .white
|
||||||
navigationBar.shadowImage = UIImage()
|
navigationBar.shadowImage = UIImage()
|
||||||
navigationBar.isOpaque = true
|
navigationBar.isOpaque = true
|
||||||
navigationBar.tintColor = .black
|
navigationBar.tintColor = .black
|
||||||
@ -72,7 +72,7 @@ import UIKit
|
|||||||
viewController.navigationItem.hidesBackButton = (navigationItemModel.backButton != nil)
|
viewController.navigationItem.hidesBackButton = (navigationItemModel.backButton != nil)
|
||||||
|
|
||||||
navigationController.setNavigationBarHidden(navigationItemModel.hidden, animated: true)
|
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
|
let tint = navigationItemModel.tintColor.uiColor
|
||||||
navigationController.navigationBar.tintColor = tint
|
navigationController.navigationBar.tintColor = tint
|
||||||
|
|||||||
@ -81,6 +81,16 @@ open class Styler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func color() -> UIColor {
|
||||||
|
switch self {
|
||||||
|
case .B3:
|
||||||
|
return .mvmCoolGray6
|
||||||
|
|
||||||
|
default:
|
||||||
|
return .mvmBlack
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Determines if the selected font case is bold or regular.
|
/// Determines if the selected font case is bold or regular.
|
||||||
public func isBold() -> Bool {
|
public func isBold() -> Bool {
|
||||||
|
|
||||||
|
|||||||
@ -248,6 +248,8 @@
|
|||||||
|
|
||||||
// Sets the color
|
// Sets the color
|
||||||
if (color) {
|
if (color) {
|
||||||
|
self.button.layer.borderColor = color.CGColor;
|
||||||
|
[self.button setTitleColor:color forState:UIControlStateNormal];
|
||||||
[self.closeButton setTintColor:color];
|
[self.closeButton setTintColor:color];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user