UIViewID is a tiny swift package that unifies approach to uniquely identifying UIView
s by using accessibilityIdentifier
.
To get a view ID:
let id: String = view.getID()
this will either set random UUID to accessibilityIdentifier
and return it or return already set accessibilityIdentifier
.
Avoid setting accessibilityIdentifier
manually to ensure that UUID is always used and no collisions occure.
To install via Swift Package Manager (SPM) simply do the following:
- From Xcode, select from the menu File > Add Package Dependency
- Paste the URL https://github.com/leofriskey/UIViewID