Merge branch 'bugfix/tab_bar_item_accessibility_text' into 'develop'
accessibility See merge request BPHV_MIPS/mvm_core_ui!664
This commit is contained in:
commit
5a848cf47d
@ -54,6 +54,7 @@
|
||||
var tabs: [UITabBarItem] = []
|
||||
for (index, tab) in model.tabs.enumerated() {
|
||||
let tabBarItem = UITabBarItem(title: tab.title, image: MVMCoreCache.shared()?.getImageFromRegisteredBundles(tab.image), tag: index)
|
||||
tabBarItem.accessibilityLabel = tab.accessibilityText
|
||||
if #available(iOS 13.0, *) {
|
||||
} else {
|
||||
tabBarItem.titlePositionAdjustment = UIOffset(horizontal: 0, vertical: -3)
|
||||
|
||||
@ -63,11 +63,13 @@ public class TabBarItemModel: Codable {
|
||||
var title: String?
|
||||
var image: String
|
||||
var action: ActionModelProtocol
|
||||
var accessibilityText: String?
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case title
|
||||
case image
|
||||
case action
|
||||
case accessibilityText
|
||||
}
|
||||
|
||||
public init(with title: String?, image: String, action: ActionModelProtocol) {
|
||||
@ -81,6 +83,7 @@ public class TabBarItemModel: Codable {
|
||||
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
|
||||
image = try typeContainer.decode(String.self, forKey: .image)
|
||||
action = try typeContainer.decodeModel(codingKey: .action)
|
||||
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
@ -88,5 +91,6 @@ public class TabBarItemModel: Codable {
|
||||
try container.encodeIfPresent(title, forKey: .title)
|
||||
try container.encode(image, forKey: .image)
|
||||
try container.encodeModel(action, forKey: .action)
|
||||
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user