enforce an action
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
484b578568
commit
61f9fb9946
@ -44,18 +44,14 @@ import VDS
|
|||||||
isEnabled = viewModel.enabled
|
isEnabled = viewModel.enabled
|
||||||
surface = viewModel.surface
|
surface = viewModel.surface
|
||||||
breadcrumbModels = viewModel.breadcrumbs.compactMap { [unowned self] breadcrumb in
|
breadcrumbModels = viewModel.breadcrumbs.compactMap { [unowned self] breadcrumb in
|
||||||
var onClick: ((BreadcrumbItem) -> Void)?
|
|
||||||
if let action = breadcrumb.action {
|
|
||||||
onClick = { _ in
|
|
||||||
MVMCoreUIActionHandler.performActionUnstructured(with: action,
|
|
||||||
sourceModel: breadcrumb,
|
|
||||||
additionalData: self.additionalData,
|
|
||||||
delegateObject: self.delegateObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return .init(text: breadcrumb.text,
|
return .init(text: breadcrumb.text,
|
||||||
selected: breadcrumb.selected,
|
selected: breadcrumb.selected,
|
||||||
onClick: onClick)
|
onClick: { _ in
|
||||||
|
MVMCoreUIActionHandler.performActionUnstructured(with: breadcrumb.action,
|
||||||
|
sourceModel: breadcrumb,
|
||||||
|
additionalData: self.additionalData,
|
||||||
|
delegateObject: self.delegateObject)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -71,7 +71,7 @@ open class BreadcrumbModel: MoleculeModelProtocol {
|
|||||||
|
|
||||||
open var text: String = ""
|
open var text: String = ""
|
||||||
open var selected: Bool = false
|
open var selected: Bool = false
|
||||||
open var action: ActionModelProtocol?
|
open var action: ActionModelProtocol
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -92,7 +92,7 @@ open class BreadcrumbModel: MoleculeModelProtocol {
|
|||||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
text = try container.decode(String.self, forKey: .text)
|
text = try container.decode(String.self, forKey: .text)
|
||||||
selected = try container.decodeIfPresent(Bool.self, forKey: .selected) ?? false
|
selected = try container.decodeIfPresent(Bool.self, forKey: .selected) ?? false
|
||||||
action = try container.decodeModelIfPresent(codingKey: .action)
|
action = try container.decodeModel(codingKey: .action)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user