Skip to content

Instantly share code, notes, and snippets.

@ming-chu
Created March 6, 2018 07:16
Show Gist options
  • Save ming-chu/bf11999737fb1bdeb538fcfe0fdbe3f3 to your computer and use it in GitHub Desktop.
Save ming-chu/bf11999737fb1bdeb538fcfe0fdbe3f3 to your computer and use it in GitHub Desktop.
Find a view by using accessibilityIdentifier estension
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