title offset and default for 3 dot O
This commit is contained in:
parent
b4d7392675
commit
558e1803e5
@ -59,6 +59,7 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc
|
|||||||
open var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]?
|
open var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]?
|
||||||
open var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]?
|
open var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]?
|
||||||
open var titleView: MoleculeModelProtocol?
|
open var titleView: MoleculeModelProtocol?
|
||||||
|
open var titleOffset: UIOffset?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
@ -84,6 +85,7 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc
|
|||||||
case additionalRightButtons
|
case additionalRightButtons
|
||||||
case titleView
|
case titleView
|
||||||
case style
|
case style
|
||||||
|
case titleOffset
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -110,6 +112,7 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc
|
|||||||
additionalRightButtons = try typeContainer.decodeModelsIfPresent(codingKey: .additionalRightButtons)
|
additionalRightButtons = try typeContainer.decodeModelsIfPresent(codingKey: .additionalRightButtons)
|
||||||
titleView = try typeContainer.decodeModelIfPresent(codingKey: .titleView)
|
titleView = try typeContainer.decodeModelIfPresent(codingKey: .titleView)
|
||||||
style = try typeContainer.decodeIfPresent(NavigationItemStyle.self, forKey: .style)
|
style = try typeContainer.decodeIfPresent(NavigationItemStyle.self, forKey: .style)
|
||||||
|
titleOffset = try typeContainer.decodeIfPresent(UIOffset.self, forKey: .titleOffset) ?? UIOffset(horizontal: -CGFloat.greatestFiniteMagnitude, vertical: 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
@ -127,6 +130,7 @@ open class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProtoc
|
|||||||
try container.encodeModelsIfPresent(additionalRightButtons, forKey: .additionalRightButtons)
|
try container.encodeModelsIfPresent(additionalRightButtons, forKey: .additionalRightButtons)
|
||||||
try container.encodeModelIfPresent(titleView, forKey: .titleView)
|
try container.encodeModelIfPresent(titleView, forKey: .titleView)
|
||||||
try container.encodeIfPresent(style, forKey: .style)
|
try container.encodeIfPresent(style, forKey: .style)
|
||||||
|
try container.encodeIfPresent(titleOffset, forKey: .titleOffset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,4 +20,5 @@ public protocol NavigationItemModelProtocol {
|
|||||||
var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set }
|
var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set }
|
||||||
var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set }
|
var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set }
|
||||||
var titleView: MoleculeModelProtocol? { get set }
|
var titleView: MoleculeModelProtocol? { get set }
|
||||||
|
var titleOffset: UIOffset? { get }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,6 +91,7 @@ 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)
|
||||||
|
appearance.titlePositionAdjustment = navigationItemModel.titleOffset ?? .zero
|
||||||
appearance.shadowColor = navigationItemModel.line?.backgroundColor?.uiColor ?? .clear
|
appearance.shadowColor = navigationItemModel.line?.backgroundColor?.uiColor ?? .clear
|
||||||
appearance.shadowImage = getNavigationBarShadowImage(for: navigationItemModel)?.withRenderingMode(.alwaysTemplate)
|
appearance.shadowImage = getNavigationBarShadowImage(for: navigationItemModel)?.withRenderingMode(.alwaysTemplate)
|
||||||
navigationBar.standardAppearance = appearance
|
navigationBar.standardAppearance = appearance
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user