ArcGIS Runtime SDK for iOS: AGSPopup Class Reference
ArcGIS Runtime SDK for iOS  100.14
AGSPopup Class Reference

Description

A popup which displays a geo-element's information.

Instances of this class represent a popup which associates a geo-element with popup definition for the purpose of displaying in an AGSPopupsViewController.

Since
100
Inheritance diagram for AGSPopup:
AGSObject

Instance Methods

(id< AGSCancelable >) - evaluateExpressionsWithCompletion:
 
(NSString *) - formattedValueForField:
 
(instancetype) - initWithGeoElement:
 
(instancetype) - initWithGeoElement:popupDefinition:
 
(nullable NSString *) - stringForTemplatedString:
 

Class Methods

(instancetype) + popupWithGeoElement:
 
(instancetype) + popupWithGeoElement:popupDefinition:
 

Properties

NSArray< AGSPopupElement * > * evaluatedElements
 
id< AGSGeoElementgeoElement
 
AGSPopupDefinitionpopupDefinition
 
AGSSymbolsymbol
 
NSString * title
 

Method Documentation

◆ evaluateExpressionsWithCompletion:

- (id<AGSCancelable>) evaluateExpressionsWithCompletion: (void(^)(NSArray< AGSPopupExpressionEvaluation * > *__nullable results, NSError *__nullable error))  completion

Asynchronously evaluates all expressions available at AGSPopupDefinition::expressions or at AGSExpressionPopupElement::popupExpression. The expression can include Arcade FeatureSet functions, which need to be evaluated asynchronously. Also populates the AGSPopup::evaluatedElements from the AGSPopupDefinition::elements. During the evaluation, each AGSExpressionPopupElement is replaced by the AGSPopupElement returned by the Arcade expression and each placeholder is replaced by its value.

This method must be called before displaying the popup information in a UI so you can use synchronous methods formattedValueForField: and stringForTemplatedString: to get the formatted string representation. If there are no AGSPopupDefinition::expressions and no popup elements of type AGSExpressionPopupElement then the result array will be empty.

The AGSPopupExpression may be used in the AGSPopupDefinition::fields, AGSPopupDefinition.media, AGSPopupDefinition.title and AGSPopupDefinition.description.

Parameters
completionBlock that is invoked when the operation finishes. The results parameter is populated if the operation completed successfully, otherwise the error parameter is populated.
Returns
An operation which can be canceled.
Since
100.8

◆ formattedValueForField:

- (NSString*) formattedValueForField: (AGSPopupField *)  popupField

A string you can use in a display for the popup's field value. The string will have the proper formatting based on the field type and AGSPopupField configuration. Dates and times are returned in the local timezone. If AGSPopupDefinition::expressions is not empty then the AGSPopupField may be using expressions with Arcade FeatureSet functions. Use evaluateExpressionsWithCompletion: to evaluate the Arcade expressions before trying to get the formatted string representation of the popup field's value, otherwise it may return an empty string.

If the field is part of an AGSCodedValueDomain, the AGSCodedValue::name is returned.

Parameters
popupFieldThe field for which a properly formatted value is desired.
Returns
A user-friendly string representing the value.
Since
100

◆ initWithGeoElement:

- (instancetype) initWithGeoElement: (id< AGSGeoElement >)  geoElement

Creates a popup for the provided geo-element. This method creates a default AGSPopupDefinition with default properties and default popup elements based on the given AGSGeoElement.

Parameters
geoElementThe geo-element for the popup, such as an AGSFeature or AGSGraphic.
Since
100

◆ initWithGeoElement:popupDefinition:

- (instancetype) initWithGeoElement: (id< AGSGeoElement >)  geoElement
popupDefinition: (nullable AGSPopupDefinition *)  popupDefinition 

Creates a popup for the provided geo-element based on the popup definition.

Parameters
geoElementThe geo-element for the popup, such as an AGSFeature or AGSGraphic.
popupDefinitionThe popup definition specifying how the geo-element should be represented in the popup. If you pass nil for the popupDefinition a default one will be created for you based on the geo-element's attributes or schema.
Since
100

◆ popupWithGeoElement:

+ (instancetype) popupWithGeoElement: (id< AGSGeoElement >)  geoElement

Creates a popup for the provided geo-element. This method creates a default AGSPopupDefinition with default properties and default popup elements based on the given AGSGeoElement.

Parameters
geoElementThe geo-element for the popup, such as an AGSFeature or AGSGraphic.
Returns
A new popup.
Since
100

◆ popupWithGeoElement:popupDefinition:

+ (instancetype) popupWithGeoElement: (id< AGSGeoElement >)  geoElement
popupDefinition: (nullable AGSPopupDefinition *)  popupDefinition 

Creates a popup for the provided geo-element based on the popup definition.

Parameters
geoElementThe geo-element for the popup, such as an AGSFeature or AGSGraphic.
popupDefinitionThe popup definition specifying how the geo-element should be represented in the popup. If you pass nil for the popupDefinition a default one will be created for you based on the geo-element's attributes or schema.
Returns
A new popup.
Since
100

◆ stringForTemplatedString:

- (nullable NSString*) stringForTemplatedString: (NSString *)  templatedString

Substitutes attribute templates in a string with actual values. If AGSPopupDefinition::expressions is not empty then the AGSPopupField may be using expressions with Arcade FeatureSet functions. Use evaluateExpressionsWithCompletion: to evaluate the Arcade expressions before trying to get the string for templated string, otherwise it may return an empty string.

Parameters
templatedStringThe templated string.
Returns
A user-friendly string.
Since
100

Property Documentation

◆ evaluatedElements

- (NSArray<AGSPopupElement *>*) evaluatedElements
readnonatomiccopy

An array of AGSPopupElement objects evaluated asynchronously by evaluateExpressionsWithCompletion:.

During the evaluation, each AGSExpressionPopupElement is replaced by the AGSPopupElement returned by the Arcade expression and each placeholder is replaced by its value. If the Arcade expression returns a list of attributes to be used by the popup element, these attributes will be used by formattedValueForField:.

The array is empty while evaluateExpressionsWithCompletion: has not been executed, and is cleared if evaluateExpressionsWithCompletion: is executed more than once. After evaluation, the order of the popup elements in the array matches the order elements present in AGSPopupDefinition::elements and shown in the popup window. If an AGSExpressionPopupElement fails to be evaluated, then it will be skipped in the array. Use the array of AGSPopupExpressionEvaluation returned from evaluateExpressionsWithCompletion: to learn the cause of the error.

See also
AGSPopupDefinition::elements, - evaluateExpressionsWithCompletion:
Since
100.14

◆ geoElement

- (id<AGSGeoElement>) geoElement
readnonatomicstrong

The geo-element which this popup is associated with.

Since
100

◆ popupDefinition

- (AGSPopupDefinition*) popupDefinition
readnonatomicstrong

A popup definition that dictates which information belonging to the geo-element should be displayed in the popup and how it should be formatted.

Since
100

◆ symbol

- (AGSSymbol*) symbol
readnonatomicstrong

The popup symbol.

Since
100

◆ title

- (NSString*) title
readnonatomiccopy

The text to display as the popup title.

Since
100