refactored PreDefinedFocusedelement func
This commit is contained in:
parent
c1392f4253
commit
44d2aa630e
@ -171,12 +171,17 @@ open class AccessibilityHandler {
|
||||
open func canPostAccessbilityNotification(for viewController: UIViewController) -> Bool { true }
|
||||
|
||||
func getPreDefinedFocusedElementIfAny() -> UIView? {
|
||||
guard let accessibilityId, let models: [any Identifiable] = (delegate?.delegateObject?() as? MVMCoreUIDelegateObject)?.moleculeDelegate?.getRootMolecules().allMoleculesOfType() else { return nil }
|
||||
guard !models.isEmpty,
|
||||
let model = (models.filter { ($0.id as? String) == accessibilityId }).first else { return nil }
|
||||
guard let accessibilityId else { return nil }
|
||||
var modelElement: MoleculeModelProtocol?
|
||||
((delegate?.delegateObject?() as? MVMCoreUIDelegateObject)?.moleculeDelegate)?.getRootMolecules().depthFirstTraverse(options: .leafNodesOnly, depth: 0) { index, model, stop in
|
||||
if model.id == accessibilityId {
|
||||
modelElement = model
|
||||
stop = true
|
||||
}
|
||||
}
|
||||
return (delegate as? UIViewController)?.view?.getMoleculeViews { (subView: MoleculeViewProtocol) in
|
||||
guard let moleculeModel = (subView as? MoleculeViewModelProtocol)?.moleculeModel as? (any Identifiable),
|
||||
(moleculeModel.id as? String) == (model.id as? String) else {
|
||||
guard let modelElement, let moleculeModel = (subView as? MoleculeViewModelProtocol)?.moleculeModel,
|
||||
moleculeModel.id == modelElement.id else {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
||||
Loading…
Reference in New Issue
Block a user