Merge branch 'feature/optional_title' into 'release/8_4_0'

Feature/optional title

See merge request BPHV_MIPS/mvm_core_ui!655
This commit is contained in:
Pfeil, Scott Robert 2021-01-20 09:50:23 -05:00
commit 4243e80d24

View File

@ -60,7 +60,7 @@ public class TabBarModel: MoleculeModelProtocol {
}
public class TabBarItemModel: Codable {
var title: String
var title: String?
var image: String
var action: ActionModelProtocol
@ -70,7 +70,7 @@ public class TabBarItemModel: Codable {
case action
}
public init(with title: String, image: String, action: ActionModelProtocol) {
public init(with title: String?, image: String, action: ActionModelProtocol) {
self.title = title
self.image = image
self.action = action
@ -78,14 +78,14 @@ public class TabBarItemModel: Codable {
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
title = try typeContainer.decode(String.self, forKey: .title)
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
image = try typeContainer.decode(String.self, forKey: .image)
action = try typeContainer.decodeModel(codingKey: .action)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(title, forKey: .title)
try container.encodeIfPresent(title, forKey: .title)
try container.encode(image, forKey: .image)
try container.encodeModel(action, forKey: .action)
}