iOS app hierarchy across different os versions

Hi,

In our application we have an element consider it to be a search bar.

In ios 13 simulator if i install the app file i could see that the search bar is located inside XCUIElementTypeStaticText in lower version like ios12 it is located inside XCUIElementTypeOther.

Is this expected ? For the same app file does the app structure varies for different os versions?

If it’s the case how to handle it? Because if i write if statement based on os version the code would turn clumsy and difficult to maintain.

Any points ???