Use different feature request modes to populate the map from a service feature table.
Use case
Feature tables can be initialized with a feature request mode which controls how frequently features are requested and locally cached in response to panning, zooming, selecting, or querying. The feature request mode affects performance and should be chosen based on considerations such as how often the data is expected to change or how often changes in the data should be reflected to the user.
OnInteractionCache - fetches features within the current extent when needed (after a pan or zoom action) from the server and caches those features in a table on the client. Queries will be performed locally if the features are present, otherwise they will be requested from the server. This mode minimizes requests to the server and is useful for large batches of features which will change infrequently.
OnInteractionNoCache - always fetches features from the server and doesn't cache any features on the client. This mode is best for features that may change often on the server or whose changes need to always be visible.
NOTE: No cache does not guarantee that features won't be cached locally. Feature request mode is a performance concept unrelated to data security.
ManualCache - only fetches features when explicitly populated from a query. This mode is best for features that change minimally or when it is not critical for the user to see the latest changes.
How to use the sample
Choose a request mode by tapping the "Mode" button. Pan and zoom to see how the features update at different scales. If you choose Manual cache, tap the "Populate" button to manually get a cache with a subset of features (where "Condition < 4") within the extent.
Note: The service limits requests to 1000 features.
How it works
Create an AGSServiceFeatureTable with a feature service URL.
Set the featureRequestMode property of the AGSServiceFeatureTable to the desired mode (Cache, No cache, or Manual cache) before the table is loaded.
If using Manual cache, populate the features with AGSServiceFeatureTable.populateFromService(with:clearCache:outFields:completion:).
Create an AGSFeatureLayer with the feature table and add it to a map's operational layers to display it.
This sample uses the Trees of Portland service showcasing over 200,000 street trees in Portland, OR. Each tree point models the health of the tree (green - better, red - worse) as well as the diameter of its trunk.