diff --git a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 410c3221..8ab7b07b 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -338,6 +338,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) // MARK:- MoleculeViewProtocol public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.set(with: model, delegateObject, additionalData) self.delegateObject = delegateObject guard let model = model as? ToggleModel else { return } diff --git a/MVMCoreUI/Atomic/Molecules/Items/StackItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/StackItemModel.swift index 12254fb5..436ed9cd 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/StackItemModel.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/StackItemModel.swift @@ -9,6 +9,10 @@ import Foundation @objcMembers public class StackItemModel: ContainerModel, StackItemModelProtocol, MoleculeModelProtocol { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + public static var identifier: String = "simpleStackItem" public var moleculeName: String = StackItemModel.identifier public var backgroundColor: Color? @@ -16,12 +20,18 @@ import Foundation public var percent: Int? public var gone: Bool = false + //-------------------------------------------------- + // MARK: - Initializer + //-------------------------------------------------- + public convenience init(spacing: CGFloat? = nil, percent: Int? = nil, horizontalAlignment: UIStackView.Alignment? = nil, verticalAlignment: UIStackView.Alignment? = nil, gone: Bool? = nil) { self.init() + self.horizontalAlignment = horizontalAlignment self.verticalAlignment = verticalAlignment self.spacing = spacing self.percent = percent + if let gone = gone { self.gone = gone } diff --git a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift index 9672b789..ff530d92 100644 --- a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift @@ -52,18 +52,18 @@ import UIKit body.styleB2(true) } - public func eyebrow(isHidden: Bool) { - - stack.stackModel?.molecules[0].gone = isHidden - - if isHidden { - accessibilityElements = [headline, body, link] - } else { - accessibilityElements = [eyebrow, headline, body, link] - } - - stack.restack() - } +// public func eyebrow(isHidden: Bool) { +// +// stack.stackModel?.molecules[0].gone = isHidden +// +// if isHidden { +// accessibilityElements = [headline, body, link] +// } else { +// accessibilityElements = [eyebrow, headline, body, link] +// } +// +// stack.restack() +// } //-------------------------------------------------- // MARK: - MoleculeViewProtocol diff --git a/MVMCoreUI/Atomic/Organisms/Stack.swift b/MVMCoreUI/Atomic/Organisms/Stack.swift index b7dab506..e957a2a6 100644 --- a/MVMCoreUI/Atomic/Organisms/Stack.swift +++ b/MVMCoreUI/Atomic/Organisms/Stack.swift @@ -15,10 +15,11 @@ open class Stack: Container where T: (StackModelProtocol & MoleculeModelProto //-------------------------------------------------- open var contentView: UIView = MVMCoreUICommonViewsUtility.commonView() + open var stackItems: [UIView] = [] + open var stackModel: T? { get { return model as? T } } - open var stackItems: [UIView] = [] //-------------------------------------------------- // MARK: - Helpers @@ -37,18 +38,21 @@ open class Stack: Container where T: (StackModelProtocol & MoleculeModelProto guard let stackModel = stackModel else { return } let stackItems = self.stackItems self.stackItems = [] - let lastItemIndex = stackModel.molecules.lastIndex(where: { (item) -> Bool in - return !item.gone - }) + let lastItemIndex = stackModel.molecules.lastIndex { !$0.gone } // Adds the views let totalSpace = getTotalSpace() for (index, view) in stackItems.enumerated() { addView(view, stackModel.molecules[index], totalSpacing: totalSpace, lastItem: lastItemIndex == index) } - + isAccessibilityElement = false - accessibilityElements = stackItems + var accessibleViews: [Any] = [] + for (index, view) in stackItems.enumerated() where !stackModel.molecules[index].gone { + accessibleViews.append(view) + } + + accessibilityElements = accessibleViews } /// Removes all stack items views from the view. diff --git a/MVMCoreUI/BaseClasses/Control.swift b/MVMCoreUI/BaseClasses/Control.swift index b73fcc81..ebb88977 100644 --- a/MVMCoreUI/BaseClasses/Control.swift +++ b/MVMCoreUI/BaseClasses/Control.swift @@ -12,6 +12,7 @@ import UIKit //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- + open var model: MoleculeModelProtocol? private var initialSetupPerformed = false diff --git a/MVMCoreUI/BaseClasses/TableViewCell.swift b/MVMCoreUI/BaseClasses/TableViewCell.swift index 7af0b57b..dc4d270a 100644 --- a/MVMCoreUI/BaseClasses/TableViewCell.swift +++ b/MVMCoreUI/BaseClasses/TableViewCell.swift @@ -197,10 +197,13 @@ import UIKit // MARK: - Caret View /// Adds the standard mvm style caret to the accessory view @objc public func addCaretViewAccessory() { + guard accessoryView == nil else { return } let caret = CaretView(lineWidth: 1) caret.translatesAutoresizingMaskIntoConstraints = true + caret.isAccessibilityElement = true + caret.accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccTabHint") caret.size = .small(.vertical) if let size = caret.size?.dimensions() { caret.frame = CGRect(origin: CGPoint.zero, size: size) diff --git a/MVMCoreUI/Containers/Views/Container/ContainerModel.swift b/MVMCoreUI/Containers/Views/Container/ContainerModel.swift index a18e8589..ec6f9769 100644 --- a/MVMCoreUI/Containers/Views/Container/ContainerModel.swift +++ b/MVMCoreUI/Containers/Views/Container/ContainerModel.swift @@ -9,6 +9,10 @@ import Foundation open class ContainerModel: ContainerModelProtocol, Codable { + //-------------------------------------------------- + // MARK: - Properties + //-------------------------------------------------- + public var horizontalAlignment: UIStackView.Alignment? public var verticalAlignment: UIStackView.Alignment? public var useHorizontalMargins: Bool? @@ -17,6 +21,10 @@ open class ContainerModel: ContainerModelProtocol, Codable { public var topMarginPadding: CGFloat? public var bottomMarginPadding: CGFloat? + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + private enum CodingKeys: String, CodingKey { case verticalAlignment case horizontalAlignment @@ -26,6 +34,10 @@ open class ContainerModel: ContainerModelProtocol, Codable { case bottomMarginPadding } + //-------------------------------------------------- + // MARK: - Initializers + //-------------------------------------------------- + public init() {} public convenience init(horizontalAlignment: UIStackView.Alignment? = nil, verticalAlignment: UIStackView.Alignment? = nil) { @@ -33,6 +45,10 @@ open class ContainerModel: ContainerModelProtocol, Codable { self.horizontalAlignment = horizontalAlignment self.verticalAlignment = verticalAlignment } + + //-------------------------------------------------- + // MARK: - Codec + //-------------------------------------------------- required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) diff --git a/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings b/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings index a7f4cdf2..48cbe3ce 100644 --- a/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings +++ b/MVMCoreUI/SupportingFiles/Strings/en.lproj/Localizable.strings @@ -6,56 +6,73 @@ Copyright © 2017 myverizon. All rights reserved. */ -//// Accessibility +// MARK: Accessibility "AccCloseButton" = "Close"; "swipe_to_select_with_action_hint" = "swipe up or down to select action, then double tap to select."; -// Tab + + +// MARK: Tab "AccTab" = ", tab"; "AccTabHint" = "Double tap to select."; "AccTabIndex" = ", %ld of %ld"; -// top alert + + +// MARK: Top alert "toptabbar_tab_selected" = ", tab, Selected"; "AccTopAlertClosed" = "Top alert notification is closed."; "top_alert_notification" = "Top alert notification"; -// Textfield + + +// MARK: Textfield "textfield_today_string" = "Today"; "textfield_error_message" = "%@.\n The error message.\n %@"; "textfield_picker_item" = " picker item"; "textfield_regular" = " regular"; "textfield_disabled_state" = "disabled"; -// MDNTextfield + + +// MARK: MDNTextfield "textfield_contacts_barbutton" = "My Contacts"; "textfield_phone_format_error_message" = "Invalid phone number format."; -// DigitTextfield + + +// MARK: DigitTextfield "mfdigittextfield_regular" = " regular"; -// Camera + + +// MARK: Camera "AccCameraButton" = "Camera Button"; "AccCameraHint" = "Double tap to launch camera for scanning"; -// Checkbox + +// MARK: Checkbox "checkbox_action_hint" = "Double tap to change state"; "checkbox_checked_state" = "Checked"; "checkbox_unchecked_state" = "Unchecked"; "checkbox_desc_state" = "%@ CheckBox %@"; -// Radio Button + +// MARK: Radio Button "radio_action_hint" = "Double tap to select"; "radio_selected_state" = "Selected"; "radio_not_selected_state" = "Not Selected"; "radio_desc_state" = "Option"; -// Switch / Toggle + +// MARK: Switch / Toggle "mfswitch_buttonlabel" = "Switch Button"; "Toggle_buttonlabel" = "Toggle Button"; "AccOn" = "on"; "AccOff" = "off"; "AccToggleHint" = "double tap to toggle"; -// Carousel + +// MARK: Carousel "MVMCoreUIPageControl_currentpage_index" = "page %ld of %ld"; "MVMCoreUIPageControlslides_currentpage_index" = "slide %ld of %ld"; -//Styler + +// MARK: Styler "CountDownDay" = " day"; "CountDownHour" = " hour"; "CountDownMin" = " min";