Tag iOS Views

Prev Next

Why should you tag iOS views?

Whatfix Mobile identifies the screen of native apps uniquely with the properties of an element like accessibility identifier, accessibility label, and tag on the screen. Adding these properties helps in identifying the element and hence the screen more accurately.

Add Tag, Accessibility Identifier, and Accessibility Label to a view

Info

Set either tag, accessibilityLabel, or accessibilityIdentifier to make it uniquely identifiable on the current screen.

Swift

view.tag = 101 // unique value for the view
view.accessibilityLabel = "cart_button" // unique label for the view
view.accessibilityIdentifier = "cart_button" // unique identifer for the view

Objective C

view.tag = 101;
view.accessibilityLabel = @"cart_button";
view.accessibilityIdentifier = @"cart_button";