name update
This commit is contained in:
parent
a03965cafe
commit
44a57ab96e
@ -33,7 +33,7 @@ open class NavigationBar: UINavigationBar, 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? NavigationItemModel else { return }
|
guard let model = model as? NavigationItemModel else { return }
|
||||||
NavigationController.setNavigation(bar: self, model: model)
|
NavigationController.set(navigationBar: self, model: model)
|
||||||
line.setOptional(with: model.line, delegateObject, additionalData)
|
line.setOptional(with: model.line, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -83,17 +83,17 @@ import UIKit
|
|||||||
let navigationBar = navigationBar as? MoleculeViewProtocol {
|
let navigationBar = navigationBar as? MoleculeViewProtocol {
|
||||||
navigationBar.set(with: model, nil, nil)
|
navigationBar.set(with: model, nil, nil)
|
||||||
} else {
|
} else {
|
||||||
setNavigation(bar: navigationController.navigationBar, model: navigationItemModel)
|
set(navigationBar: navigationController.navigationBar, model: navigationItemModel)
|
||||||
}
|
}
|
||||||
navigationController.setNavigationBarHidden(navigationItemModel.hidden, animated: true)
|
navigationController.setNavigationBarHidden(navigationItemModel.hidden, animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convenience function for setting the navigation bar by the model
|
/// Convenience function for setting the navigation bar by the model
|
||||||
public static func setNavigation(bar: UINavigationBar, model: NavigationItemModelProtocol) {
|
public static func set(navigationBar: UINavigationBar, model: NavigationItemModelProtocol) {
|
||||||
let font = MFStyler.fontBoldBodySmall(false)
|
let font = MFStyler.fontBoldBodySmall(false)
|
||||||
let backgroundColor = model.backgroundColor?.uiColor
|
let backgroundColor = model.backgroundColor?.uiColor
|
||||||
let tint = model.tintColor.uiColor
|
let tint = model.tintColor.uiColor
|
||||||
bar.tintColor = tint
|
navigationBar.tintColor = tint
|
||||||
if #available(iOS 13.0, *) {
|
if #available(iOS 13.0, *) {
|
||||||
let appearance = UINavigationBarAppearance()
|
let appearance = UINavigationBarAppearance()
|
||||||
appearance.configureWithOpaqueBackground()
|
appearance.configureWithOpaqueBackground()
|
||||||
@ -101,15 +101,15 @@ import UIKit
|
|||||||
NSAttributedString.Key.foregroundColor: tint];
|
NSAttributedString.Key.foregroundColor: tint];
|
||||||
appearance.backgroundColor = backgroundColor
|
appearance.backgroundColor = backgroundColor
|
||||||
appearance.titleTextAttributes.updateValue(tint, forKey: .foregroundColor)
|
appearance.titleTextAttributes.updateValue(tint, forKey: .foregroundColor)
|
||||||
bar.standardAppearance = appearance
|
navigationBar.standardAppearance = appearance
|
||||||
bar.scrollEdgeAppearance = appearance
|
navigationBar.scrollEdgeAppearance = appearance
|
||||||
} else {
|
} else {
|
||||||
// Fallback on earlier versions
|
// Fallback on earlier versions
|
||||||
bar.shadowImage = UIImage()
|
navigationBar.shadowImage = UIImage()
|
||||||
bar.isOpaque = true
|
navigationBar.isOpaque = true
|
||||||
bar.titleTextAttributes = [NSAttributedString.Key.font: font,
|
navigationBar.titleTextAttributes = [NSAttributedString.Key.font: font,
|
||||||
NSAttributedString.Key.foregroundColor: tint];
|
NSAttributedString.Key.foregroundColor: tint];
|
||||||
bar.barTintColor = backgroundColor
|
navigationBar.barTintColor = backgroundColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user