addressed review comments
This commit is contained in:
parent
c6004bd6d0
commit
88505e704c
@ -15,7 +15,6 @@ public class AccessbilityOperation: MVMCoreOperation {
|
|||||||
|
|
||||||
private let argument: Any?
|
private let argument: Any?
|
||||||
private let notificationType: UIAccessibility.Notification
|
private let notificationType: UIAccessibility.Notification
|
||||||
private var timerSource: DispatchSourceTimer?
|
|
||||||
|
|
||||||
public init(notificationType: UIAccessibility.Notification, argument: Any?) {
|
public init(notificationType: UIAccessibility.Notification, argument: Any?) {
|
||||||
self.notificationType = notificationType
|
self.notificationType = notificationType
|
||||||
@ -27,24 +26,18 @@ public class AccessbilityOperation: MVMCoreOperation {
|
|||||||
stop()
|
stop()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
timerSource = DispatchSource.makeTimerSource()
|
Task { @MainActor [weak self] in
|
||||||
timerSource?.setEventHandler {
|
guard let self = self, !self.isCancelled else {
|
||||||
Task { @MainActor [weak self] in
|
self?.stop()
|
||||||
guard let self = self, !self.isCancelled else {
|
return
|
||||||
self?.stop()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
UIAccessibility.post(notification: self.notificationType, argument: self.argument)
|
|
||||||
self.markAsFinished()
|
|
||||||
}
|
}
|
||||||
|
UIAccessibility.post(notification: self.notificationType, argument: self.argument)
|
||||||
|
self.markAsFinished()
|
||||||
}
|
}
|
||||||
timerSource?.schedule(deadline: .now())
|
|
||||||
timerSource?.activate()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func stop() {
|
public func stop() {
|
||||||
guard isCancelled else { return }
|
guard isCancelled else { return }
|
||||||
timerSource?.cancel()
|
|
||||||
markAsFinished()
|
markAsFinished()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,26 +58,15 @@ open class AccessibilityHandler {
|
|||||||
queue.maxConcurrentOperationCount = 1
|
queue.maxConcurrentOperationCount = 1
|
||||||
return queue
|
return queue
|
||||||
}()
|
}()
|
||||||
private(set) var accessibilityId: String?
|
public var accessibilityId: String?
|
||||||
private var announcementText: String?
|
public var hasTopNotificationInPage: Bool = false
|
||||||
private(set) var hasTopNotitificationInPage: Bool = false
|
|
||||||
|
|
||||||
public init() {
|
public init() {
|
||||||
registerWithResponseLoaded()
|
|
||||||
registerForPageChanges()
|
registerForPageChanges()
|
||||||
registerForFocusChanges()
|
registerForFocusChanges()
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Register with Accessibility Handler listeners
|
// MARK: - Register with Accessibility Handler listeners
|
||||||
/// Registers with the notification center to know when json is updated and to capture previous accessbility focused id & announcment text
|
|
||||||
private func registerWithResponseLoaded() {
|
|
||||||
NotificationCenter.default.publisher(for: NSNotification.Name(rawValue: NotificationResponseLoaded))
|
|
||||||
.sink { [weak self] notification in
|
|
||||||
self?.accessibilityId = (notification.userInfo?[String(describing: MVMCoreLoadObject.self)] as? MVMCoreLoadObject)?.pageJSON?.optionalStringForKey("accessibilityId")
|
|
||||||
self?.announcementText = (notification.userInfo?[String(describing: MVMCoreLoadObject.self)] as? MVMCoreLoadObject)?.pageJSON?.optionalStringForKey("announcementText")
|
|
||||||
}.store(in: &anyCancellable)
|
|
||||||
}
|
|
||||||
|
|
||||||
private func registerForFocusChanges() {
|
private func registerForFocusChanges() {
|
||||||
//Since foucs shifted to other elements cancelling existing focus shift notifications if any
|
//Since foucs shifted to other elements cancelling existing focus shift notifications if any
|
||||||
NotificationCenter.default.publisher(for: UIAccessibility.elementFocusedNotification)
|
NotificationCenter.default.publisher(for: UIAccessibility.elementFocusedNotification)
|
||||||
@ -96,12 +78,14 @@ open class AccessibilityHandler {
|
|||||||
func registerForTopNotificationsChanges() {
|
func registerForTopNotificationsChanges() {
|
||||||
NotificationHandler.shared()?.onNotificationWillShow
|
NotificationHandler.shared()?.onNotificationWillShow
|
||||||
.sink { [weak self] (_, model) in
|
.sink { [weak self] (_, model) in
|
||||||
self?.hasTopNotitificationInPage = true
|
if self?.previousAccessiblityElement == nil {
|
||||||
self?.capturePreviousFocusElement()
|
self?.capturePreviousFocusElement()
|
||||||
|
}
|
||||||
}.store(in: &anyCancellable)
|
}.store(in: &anyCancellable)
|
||||||
NotificationHandler.shared()?.onNotificationShown
|
NotificationHandler.shared()?.onNotificationShown
|
||||||
.sink { [weak self] (view, model) in
|
.sink { [weak self] (view, model) in
|
||||||
self?.post(notification: .layoutChanged, argument: view)
|
self?.post(notification: .layoutChanged, argument: view)
|
||||||
|
self?.hasTopNotificationInPage = false
|
||||||
}.store(in: &anyCancellable)
|
}.store(in: &anyCancellable)
|
||||||
NotificationHandler.shared()?.onNotificationWillDismiss
|
NotificationHandler.shared()?.onNotificationWillDismiss
|
||||||
.sink { [weak self] (view, model) in
|
.sink { [weak self] (view, model) in
|
||||||
@ -129,10 +113,7 @@ open class AccessibilityHandler {
|
|||||||
|
|
||||||
private func willNavigate(_ operation: NavigationOperation) {
|
private func willNavigate(_ operation: NavigationOperation) {
|
||||||
previousAccessiblityElement = nil
|
previousAccessiblityElement = nil
|
||||||
if let announcementText {
|
if let subNavManagerController = (operation.toNavigationControllerViewControllers?.last as? MVMCoreViewManagerViewControllerProtocol)?.manager as? SubNavManagerController {
|
||||||
post(notification: .announcement, argument: announcementText)
|
|
||||||
}
|
|
||||||
if let subNavManagerController = operation.toNavigationControllerViewControllers?.last as? SubNavManagerController {
|
|
||||||
delegate = subNavManagerController.getCurrentViewController() as? MVMCoreViewControllerProtocol
|
delegate = subNavManagerController.getCurrentViewController() as? MVMCoreViewControllerProtocol
|
||||||
} else {
|
} else {
|
||||||
delegate = operation.toNavigationControllerViewControllers?.last as? MVMCoreViewControllerProtocol
|
delegate = operation.toNavigationControllerViewControllers?.last as? MVMCoreViewControllerProtocol
|
||||||
@ -164,35 +145,23 @@ open class AccessibilityHandler {
|
|||||||
|
|
||||||
//To get first focus element on the screen
|
//To get first focus element on the screen
|
||||||
open func getFirstFocusedElementOnScreen() -> Any? {
|
open func getFirstFocusedElementOnScreen() -> Any? {
|
||||||
(delegate as? UIViewController)?.navigationItem.leftBarButtonItem ?? (delegate as? UIViewController)?.navigationItem.titleView ?? (delegate as? UIViewController)?.navigationController?.navigationBar
|
(delegate as? UIViewController)?.navigationController?.navigationBar
|
||||||
}
|
}
|
||||||
|
|
||||||
//Subclass can decide to trigger Accessibility notification on screen change.
|
//Subclass can decide to trigger Accessibility notification on screen change.
|
||||||
open func canPostAccessbilityNotification(for viewController: UIViewController) -> Bool { true }
|
open func canPostAccessbilityNotification(for viewController: UIViewController) -> Bool { true }
|
||||||
|
|
||||||
func getPreDefinedFocusedElementIfAny() -> UIView? {
|
func getPreDefinedFocusedElementIfAny() -> UIView? {
|
||||||
guard let accessibilityId else { return nil }
|
guard let accessibilityId, let view = (delegate as? UIViewController)?.view else { return nil }
|
||||||
var modelElement: MoleculeModelProtocol?
|
return MVMCoreUIUtility.findViews(by: MoleculeViewProtocol.self, views: [view]).first {
|
||||||
((delegate?.delegateObject?() as? MVMCoreUIDelegateObject)?.moleculeDelegate)?.getRootMolecules().depthFirstTraverse(options: .leafNodesOnly, depth: 0) { index, model, stop in
|
($0 as? MoleculeViewModelProtocol)?.moleculeModel?.id == accessibilityId
|
||||||
if model.id == accessibilityId {
|
|
||||||
modelElement = model
|
|
||||||
stop = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return (delegate as? UIViewController)?.view?.getMoleculeViews { (subView: MoleculeViewProtocol, stop: inout Bool) in
|
|
||||||
guard let modelElement, let moleculeModel = (subView as? MoleculeViewModelProtocol)?.moleculeModel,
|
|
||||||
moleculeModel.id == modelElement.id else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
stop = true
|
|
||||||
return true
|
|
||||||
}.first
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Accessibility Handler Behaviour
|
// MARK: - Accessibility Handler Behaviour
|
||||||
///Accessibility Handler Behaviour to detect page shown and post notification to first interactive element on screen or the pre-defined focused element.
|
///Accessibility Handler Behaviour to detect page shown and post notification to first interactive element on screen or the pre-defined focused element.
|
||||||
open class AccessibilityHandlerBehavior: PageVisibilityBehavior {
|
open class AccessibilityHandlerBehavior: PageVisibilityBehavior, PageMoleculeTransformationBehavior {
|
||||||
|
|
||||||
enum RotorType: String, CaseIterable {
|
enum RotorType: String, CaseIterable {
|
||||||
|
|
||||||
@ -226,13 +195,23 @@ open class AccessibilityHandlerBehavior: PageVisibilityBehavior {
|
|||||||
|
|
||||||
required public init(model: PageBehaviorModelProtocol, delegateObject: MVMCoreUIDelegateObject?) { }
|
required public init(model: PageBehaviorModelProtocol, delegateObject: MVMCoreUIDelegateObject?) { }
|
||||||
|
|
||||||
|
public func onPageNew(rootMolecules: [MoleculeModelProtocol], _ delegateObject: MVMCoreUIDelegateObject?) {
|
||||||
|
guard let loadObject = (delegateObject?.loadDelegate as? MVMCoreViewControllerProtocol)?.loadObject else { return }
|
||||||
|
AccessibilityHandler.shared()?.accessibilityId = loadObject?.pageJSON?.optionalStringForKey("accessibilityId")
|
||||||
|
//TODO: - Need to revisit this logic
|
||||||
|
AccessibilityHandler.shared()?.hasTopNotificationInPage = loadObject?.responseJSON?.optionalDictionaryForKey("TopNotification") != nil || loadObject?.responseInfoMap?.optionalStringForKey("userMessage") != nil
|
||||||
|
if let announcementText = loadObject?.pageJSON?.optionalStringForKey("announcementText") {
|
||||||
|
AccessibilityHandler.shared()?.post(notification: .announcement, argument: announcementText)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//MARK: - PageVisibiltyBehaviour
|
//MARK: - PageVisibiltyBehaviour
|
||||||
open func willShowPage(_ delegateObject: MVMCoreUIDelegateObject?) {
|
open func willShowPage(_ delegateObject: MVMCoreUIDelegateObject?) {
|
||||||
updateAccessibilityViews(delegateObject)
|
updateAccessibilityViews(delegateObject)
|
||||||
guard let controller = delegateObject?.moleculeDelegate as? UIViewController,
|
guard let controller = delegateObject?.moleculeDelegate as? UIViewController,
|
||||||
(AccessibilityHandler.shared()?.canPostAccessbilityNotification(for: controller) ?? true),
|
(AccessibilityHandler.shared()?.canPostAccessbilityNotification(for: controller) ?? true),
|
||||||
AccessibilityHandler.shared()?.accessibilityId == nil else { return }
|
AccessibilityHandler.shared()?.accessibilityId == nil else { return }
|
||||||
if AccessibilityHandler.shared()?.hasTopNotitificationInPage ?? false {
|
if AccessibilityHandler.shared()?.hasTopNotificationInPage ?? false {
|
||||||
AccessibilityHandler.shared()?.previousAccessiblityElement = AccessibilityHandler.shared()?.getFirstFocusedElementOnScreen()
|
AccessibilityHandler.shared()?.previousAccessiblityElement = AccessibilityHandler.shared()?.getFirstFocusedElementOnScreen()
|
||||||
} else {
|
} else {
|
||||||
AccessibilityHandler.shared()?.post(notification: .layoutChanged, argument: AccessibilityHandler.shared()?.getFirstFocusedElementOnScreen())
|
AccessibilityHandler.shared()?.post(notification: .layoutChanged, argument: AccessibilityHandler.shared()?.getFirstFocusedElementOnScreen())
|
||||||
@ -246,7 +225,8 @@ open class AccessibilityHandlerBehavior: PageVisibilityBehavior {
|
|||||||
updateAccessibilityViews(delegateObject) //To track FAB & HAB elements on UI
|
updateAccessibilityViews(delegateObject) //To track FAB & HAB elements on UI
|
||||||
identifyAndPrepareRotors()
|
identifyAndPrepareRotors()
|
||||||
guard let accessibilityElement = AccessibilityHandler.shared()?.getPreDefinedFocusedElementIfAny() else { return }
|
guard let accessibilityElement = AccessibilityHandler.shared()?.getPreDefinedFocusedElementIfAny() else { return }
|
||||||
if AccessibilityHandler.shared()?.hasTopNotitificationInPage ?? false {
|
AccessibilityHandler.shared()?.accessibilityId = nil
|
||||||
|
if AccessibilityHandler.shared()?.hasTopNotificationInPage ?? false {
|
||||||
AccessibilityHandler.shared()?.previousAccessiblityElement = accessibilityElement
|
AccessibilityHandler.shared()?.previousAccessiblityElement = accessibilityElement
|
||||||
} else {
|
} else {
|
||||||
AccessibilityHandler.shared()?.post(notification: .layoutChanged, argument: accessibilityElement)
|
AccessibilityHandler.shared()?.post(notification: .layoutChanged, argument: accessibilityElement)
|
||||||
@ -254,8 +234,8 @@ open class AccessibilityHandlerBehavior: PageVisibilityBehavior {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//MARK: - Accessibility Methods
|
//MARK: - Accessibility Methods
|
||||||
|
|
||||||
private func updateAccessibilityViews(_ delegateObject: MVMCoreUIDelegateObject?) {
|
private func updateAccessibilityViews(_ delegateObject: MVMCoreUIDelegateObject?) {
|
||||||
|
//TODO: - Need to revisit this logic
|
||||||
var accessibilityElements: [Any?] = [MVMCoreUISplitViewController.main()?.topAlertView]
|
var accessibilityElements: [Any?] = [MVMCoreUISplitViewController.main()?.topAlertView]
|
||||||
if let managerController = (delegateObject?.moleculeDelegate as? MVMCoreViewManagerViewControllerProtocol)?.manager as? SubNavManagerController {
|
if let managerController = (delegateObject?.moleculeDelegate as? MVMCoreViewManagerViewControllerProtocol)?.manager as? SubNavManagerController {
|
||||||
accessibilityElements.append(managerController.navigationController)
|
accessibilityElements.append(managerController.navigationController)
|
||||||
@ -313,7 +293,7 @@ open class AccessibilityHandlerBehavior: PageVisibilityBehavior {
|
|||||||
if let currentViewController = template as? MoleculeListTemplate,
|
if let currentViewController = template as? MoleculeListTemplate,
|
||||||
let templateModel = currentViewController.templateModel,
|
let templateModel = currentViewController.templateModel,
|
||||||
let tableView = currentViewController.tableView { //List templates
|
let tableView = currentViewController.tableView { //List templates
|
||||||
var rotorElements: [(model: MoleculeModelProtocol, indexPath: IndexPath)] = []
|
var rotorElements: [(model: MoleculeModelProtocol, indexPath: IndexPath)] = [] ///Identifying the trait mapped elements models
|
||||||
var currentIndexPath: IndexPath?
|
var currentIndexPath: IndexPath?
|
||||||
|
|
||||||
rotorElements = templateModel.reduceDepthFirstTraverse(options: .parentFirst, depth: 0, initialResult: rotorElements, nextPartialResult: { result, model, depth in
|
rotorElements = templateModel.reduceDepthFirstTraverse(options: .parentFirst, depth: 0, initialResult: rotorElements, nextPartialResult: { result, model, depth in
|
||||||
@ -327,24 +307,15 @@ open class AccessibilityHandlerBehavior: PageVisibilityBehavior {
|
|||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
|
|
||||||
let headerViewElements = currentViewController.tableView.tableHeaderView?.getMoleculeViews { (subView: MoleculeViewProtocol, _) in
|
let headerViewElements = MVMCoreUIUtility.findViews(by: MoleculeViewProtocol.self, views: [currentViewController.tableView.tableHeaderView].compactMap { $0 }).filter { $0.accessibilityTraits.contains(type.trait) } as [Any]
|
||||||
subView.accessibilityTraits.contains(type.trait)
|
|
||||||
} as? [Any] ?? []
|
|
||||||
|
|
||||||
let footerViewElements = currentViewController.tableView.tableFooterView?.getMoleculeViews { (subView: MoleculeViewProtocol, _) in
|
let footerViewElements = MVMCoreUIUtility.findViews(by: MoleculeViewProtocol.self, views: [currentViewController.tableView.tableFooterView].compactMap { $0 }).filter { $0.accessibilityTraits.contains(type.trait) } as [Any]
|
||||||
subView.accessibilityTraits.contains(type.trait)
|
|
||||||
} as? [Any] ?? []
|
|
||||||
|
|
||||||
let otherInteractiveElements = currentViewController.view?.getMoleculeViews(excludedViews: [tableView, tableView.tableFooterView, tableView.tableHeaderView]
|
let otherInteractiveElements = MVMCoreUIUtility.findViews(by: MoleculeViewProtocol.self, views: [currentViewController.view].compactMap { $0 }, excludedViews: [tableView, tableView.tableFooterView, tableView.tableHeaderView].compactMap { $0 }).filter { $0.accessibilityTraits.contains(type.trait) } as [Any]
|
||||||
.compactMap { $0 }) { (subView: MoleculeViewProtocol, _) in
|
|
||||||
subView.accessibilityTraits.contains(type.trait)
|
|
||||||
} as? [Any] ?? []
|
|
||||||
|
|
||||||
return headerViewElements + otherInteractiveElements + (rotorElements as [Any]) + footerViewElements
|
return headerViewElements + otherInteractiveElements + (rotorElements as [Any]) + footerViewElements
|
||||||
} else if let currentViewController = template as? MoleculeStackTemplate { //Stack templates
|
} else if let currentViewController = template as? MoleculeStackTemplate { //Stack templates
|
||||||
return currentViewController.view?.getMoleculeViews { (subView: MoleculeViewProtocol, _) in
|
return MVMCoreUIUtility.findViews(by: MoleculeViewProtocol.self, views: [currentViewController.view].compactMap { $0 }).filter { $0.accessibilityTraits.contains(type.trait) } as [Any]
|
||||||
subView.accessibilityTraits.contains(type.trait)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -369,11 +340,7 @@ open class AccessibilityHandlerBehavior: PageVisibilityBehavior {
|
|||||||
if let tableView = (self.delegateObj?.moleculeListDelegate as? MoleculeListTemplate)?.tableView,
|
if let tableView = (self.delegateObj?.moleculeListDelegate as? MoleculeListTemplate)?.tableView,
|
||||||
let element = rotorElement as? (model: MoleculeModelProtocol, indexPath: IndexPath) { //for List templates
|
let element = rotorElement as? (model: MoleculeModelProtocol, indexPath: IndexPath) { //for List templates
|
||||||
tableView.scrollToRow(at: element.indexPath, at: .middle, animated: false)
|
tableView.scrollToRow(at: element.indexPath, at: .middle, animated: false)
|
||||||
rotorElement = tableView.cellForRow(at: element.indexPath)?.getMoleculeViews { (subView: MoleculeViewProtocol, stop: inout Bool) in
|
rotorElement = MVMCoreUIUtility.findViews(by: MoleculeViewProtocol.self, views: [tableView.cellForRow(at: element.indexPath)].compactMap { $0 }).filter { $0.accessibilityTraits.contains(type.trait) && ($0 as? MoleculeViewModelProtocol)?.moleculeModel?.id == element.model.id }.first as Any
|
||||||
guard subView.accessibilityTraits.contains(type.trait), (subView as? MoleculeViewModelProtocol)?.moleculeModel?.id == element.model.id else { return false }
|
|
||||||
stop = true
|
|
||||||
return true
|
|
||||||
}.first as Any
|
|
||||||
}
|
}
|
||||||
self.rotorIndexes[type] = rotorIndex
|
self.rotorIndexes[type] = rotorIndex
|
||||||
AccessibilityHandler.shared()?.post(notification: .layoutChanged, argument: rotorElement)
|
AccessibilityHandler.shared()?.post(notification: .layoutChanged, argument: rotorElement)
|
||||||
@ -381,30 +348,3 @@ open class AccessibilityHandlerBehavior: PageVisibilityBehavior {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Helpers
|
|
||||||
extension UIView {
|
|
||||||
|
|
||||||
private func getNestedSubviews<T>(excludedViews: [UIView]? = nil) -> [T] {
|
|
||||||
subviews.flatMap { subView -> [T] in
|
|
||||||
guard !(excludedViews?.contains(subView) ?? false) else { return [] }
|
|
||||||
var result = subView.getNestedSubviews() as [T]
|
|
||||||
if let view = subView as? T { result.append(view) }
|
|
||||||
return result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func getMoleculeViews<T>(excludedViews: [UIView]? = nil, filter: ((T, inout Bool) -> Bool)) -> [T] {
|
|
||||||
var stop = false
|
|
||||||
var results: [T] = []
|
|
||||||
for element: T in getNestedSubviews(excludedViews: excludedViews) {
|
|
||||||
if filter(element, &stop) {
|
|
||||||
results.append(element)
|
|
||||||
}
|
|
||||||
if stop {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -151,6 +151,5 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol, Identifiable
|
|||||||
try container.encodeIfPresent(fieldKey, forKey: .fieldKey)
|
try container.encodeIfPresent(fieldKey, forKey: .fieldKey)
|
||||||
try container.encodeIfPresent(groupName, forKey: .groupName)
|
try container.encodeIfPresent(groupName, forKey: .groupName)
|
||||||
try container.encode(readOnly, forKey: .readOnly)
|
try container.encode(readOnly, forKey: .readOnly)
|
||||||
try container.encodeIfPresent(id, forKey: .id)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@ public extension MVMCoreUIUtility {
|
|||||||
/// - type: The type you are looking for.
|
/// - type: The type you are looking for.
|
||||||
/// - views: The starting array of subviews.
|
/// - views: The starting array of subviews.
|
||||||
/// - Returns: Will return an array of any view associated with the given type. Will return an empty array of none were found.
|
/// - Returns: Will return an array of any view associated with the given type. Will return an empty array of none were found.
|
||||||
static func findViews<T>(by type: T.Type, views: [UIView]) -> [T] {
|
static func findViews<T>(by type: T.Type, views: [UIView], excludedViews: [UIView] = []) -> [T] {
|
||||||
|
|
||||||
guard !views.isEmpty else { return [] }
|
guard !views.isEmpty else { return [] }
|
||||||
|
|
||||||
@ -47,6 +47,9 @@ public extension MVMCoreUIUtility {
|
|||||||
var matching = [T]()
|
var matching = [T]()
|
||||||
|
|
||||||
for view in views {
|
for view in views {
|
||||||
|
guard !excludedViews.contains(view) else {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if view is T {
|
if view is T {
|
||||||
matching.append(view as! T)
|
matching.append(view as! T)
|
||||||
}
|
}
|
||||||
@ -54,7 +57,7 @@ public extension MVMCoreUIUtility {
|
|||||||
queue.append(contentsOf: view.subviews)
|
queue.append(contentsOf: view.subviews)
|
||||||
}
|
}
|
||||||
|
|
||||||
return findViews(by: type, views: queue) + matching
|
return findViews(by: type, views: queue, excludedViews: excludedViews) + matching
|
||||||
}
|
}
|
||||||
|
|
||||||
static func visibleNavigationBarStlye() -> NavigationItemStyle? {
|
static func visibleNavigationBarStlye() -> NavigationItemStyle? {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user