Created
March 6, 2018 07:16
-
-
Save ming-chu/bf11999737fb1bdeb538fcfe0fdbe3f3 to your computer and use it in GitHub Desktop.
Find a view by using accessibilityIdentifier estension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIView { | |
func findViewByAccessibilityIdentifier(accessibilityIdentifier identifier: String) -> UIView? { | |
for view in self.subviews { | |
if view.accessibilityIdentifier == identifier { | |
return view | |
} | |
} | |
return nil | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment