Can you clarify more on what you want achieve? By saying
I have a use case where I want to display a popup for features that are located within a polygon.
Is the goal to show popups only for features inside a polygon?
Popups can be constructed from a feature and a popup definition, with this initializer .init(geoElement:definition:)
The popup definition can be found on a feature layer, if it is defined when it is created in Pro or Online.
To query the features within a polygon, you can use QueryParameters with the geometry property.
So (presumably) the workflow can be
- Query all the layers (visible and invisible) to get all features within a polygon
- Get popup definitions from each layer
- Display whichever feature's popups you want