There are a lot of tutorials on the web about this, like these:
iOS:
https://medium.com/the-ministry-of-testing/adding-accessibility-identifiers-to-an-ios-app-c8e09d9c20f3
https://medium.com/justeattakeaway-tech/ios-accessibility-identifier-for-appium-uiautomation-66dd9433295c
Android:
https://www.waldo.com/blog/appium-accessibility-id
I’m giving you 2 per os, but there are a ton of these out there for native as well as other development frameworks, just a websearch away.