Skip to content

Instantly share code, notes, and snippets.

@milanstevanovic
Last active September 28, 2018 14:18
Show Gist options
  • Select an option

  • Save milanstevanovic/a61020b0641cc9852215f630d18d2347 to your computer and use it in GitHub Desktop.

Select an option

Save milanstevanovic/a61020b0641cc9852215f630d18d2347 to your computer and use it in GitHub Desktop.
protocol UITestablePage {
associatedtype UIElementType: UIElement
func makeViewTestable(_ view: UIView, using element: UIElementType)
func makeViewTestable(_ view: UIView, using element: UIElementType, sequence: String)
}
extension UITestablePage {
func makeViewTestable(_ view: UIView, using element: UIElementType) {
view.accessibilityIdentifier = element.accessibilityIdentifier
}
func makeViewTestable(_ view: UIView, using element: UIElementType, sequence: String) {
view.accessibilityIdentifier = element.rawValue(withSequence: sequence)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment