ArcGIS Runtime SDK for iOS: AGSPopupManager Class Reference
ArcGIS Runtime SDK for iOS  100.15
AGSPopupManager Class Reference

Description

A popup manager.

Instances of this class represent a popup manager that contains the necessary business logic for displaying and editing popup information for geoelements. This class is useful, for instance, if you want to create your own View Controller for displaying AGSPopup instead of using AGSPopupsViewController.

Since
100
Inheritance diagram for AGSPopupManager:

Instance Methods

(void) - cancelEditing
 
(nullable AGSContingentValuesResult *) - contingentValuesResultForField:
 
(nullable AGSDomain *) - domainForField:
 
(id< AGSCancelable >) - evaluateExpressionsWithCompletion:
 
(BOOL) - featureTypeChangeRequiresUserNoficationForTemplate:
 
(BOOL) - featureTypeChangeRequiresUserNotificationForTemplate:
 
(nullable AGSPopupField *) - fieldForName:
 
(BOOL) - fieldIsNullable:
 
(BOOL) - fieldIsTypeIDField:
 
(AGSFieldType- fieldTypeForField:
 
(void) - finishEditingWithCompletion:
 
(NSString *) - formattedValueForField:
 
(instancetype) - initWithPopup:
 
(BOOL) - isFieldInFieldGroup:
 
(NSString *) - labelForField:
 
(NSInteger) - lengthForField:
 
(nullable NSNumber *) - numberFromString:field:
 
(nullable NSNumber *) - numberFromString:field:error:
 
(nullable NSString *) - rangeValidationTextForField:
 
(BOOL) - startEditing
 
(nullable NSString *) - stringForTemplatedString:
 
(BOOL) - updateFeatureTypeWithTemplate:changeMode:validationError:
 
(BOOL) - updateValue:field:validationError:
 
(nullable NSError *) - validationErrorForField:
 
(nullable NSError *) - validationWarningForField:
 
(nullable id) - valueForField:
 
(nullable id) - valueForFieldName:popupElement:
 

Properties

AGSPopupAttachmentManagerattachmentManager
 
NSDictionary< NSString *, NSError * > * contingencyValidationErrors
 
NSDictionary< NSString *, NSError * > * contingencyValidationWarnings
 
AGSSketchEditorcurrentSketchEditor
 
NSString * customDescriptionHTML
 
id< AGSPopupManagerDelegatedelegate
 
NSArray< AGSPopupField * > * displayFields
 
NSArray< AGSPopupField * > * editableDisplayFields
 
BOOL editing
 
NSString * editSummary
 
NSArray< AGSPopupElement * > * evaluatedElements
 
AGSFeatureTypefeatureType
 
BOOL geoElementValid
 
AGSPopuppopup
 
BOOL shouldAllowDelete
 
BOOL shouldAllowEdit
 
BOOL shouldAllowEditAttachments
 
BOOL shouldAllowEditGeometry
 
BOOL shouldShowAttachments
 
BOOL shouldShowCustomDescriptionHTML
 
BOOL shouldShowEditSummary
 
BOOL shouldShowMedia
 
AGSSymbolsymbol
 
NSString * title
 

Method Documentation

◆ cancelEditing

- (void) cancelEditing

Cancels the editing of the popup. This reverts the geoelement back to its original state.

Since
100

◆ contingentValuesResultForField:

- (nullable AGSContingentValuesResult *) contingentValuesResultForField: (AGSPopupField *)  popupField

Returns contingent values for each AGSFieldGroup that the specified AGSPopupField belongs to. If the specified AGSPopupField belongs to more than one field group, this method returns all groups with the values that are common in all the field groups, in AGSContingentValuesResult.

Parameters
popupFieldThe ASGPopupField to get the contingent values for.
Since
100.14

◆ domainForField:

- (nullable AGSDomain*) domainForField: (AGSPopupField *)  popupField

Returns the AGSDomain associated with a given AGSPopupField

Since
100

◆ evaluateExpressionsWithCompletion:

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

Asynchronously evaluates all expressions, including Arcade FeatureSet functions available at AGSPopupDefinition::expressions. This method must be called before displaying the popup information in a UI and after finishEditingWithCompletion: so you can use synchronous methods formattedValueForField: and stringForTemplatedString: and property AGSPopupManager::customDescriptionHTML to get the formatted NSString representation. If there are no AGSPopupDefinition::expressions then 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

◆ featureTypeChangeRequiresUserNoficationForTemplate:

- (BOOL) featureTypeChangeRequiresUserNoficationForTemplate: (nullable AGSFeatureTemplate *)  featureTemplate

Method you can call to determine if you need to notify the user when a AGSFeatureType is going to change.

Parameters
featureTemplateThe template that the user wants to change to.
Since
100
Deprecated:
100.1. Use #featureTypeChangeRequiresUserNotificationForTemplate instead

◆ featureTypeChangeRequiresUserNotificationForTemplate:

- (BOOL) featureTypeChangeRequiresUserNotificationForTemplate: (nullable AGSFeatureTemplate *)  featureTemplate

Method you can call to determine if you need to notify the user when a AGSFeatureType is going to change.

Parameters
featureTemplateThe template that the user wants to change to.
Since
100.1

◆ fieldForName:

- (nullable AGSPopupField*) fieldForName: (NSString *)  fieldName

Returns the AGSPopupField for a given field name.

Since
100

◆ fieldIsNullable:

- (BOOL) fieldIsNullable: (AGSPopupField *)  popupField

Returns whether or not a given AGSPopupField allows null values.

Since
100

◆ fieldIsTypeIDField:

- (BOOL) fieldIsTypeIDField: (AGSPopupField *)  popupField

Returns whether or not a given AGSPopupField is the TypeID field.

Since
100

◆ fieldTypeForField:

- (AGSFieldType) fieldTypeForField: (AGSPopupField *)  popupField

Returns the field type for a given AGSPopupField.

Since
100

◆ finishEditingWithCompletion:

- (void) finishEditingWithCompletion: (void(^)(NSError *__nullable error))  completion

Finish editing the popup. Async method that calls back when complete. This method commits any attachment and attribute changes to the AGSGeoElement.

Since
100

◆ formattedValueForField:

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

Returns a string you can use in a display for the current popup field's value. 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: (AGSPopup) to evaluate the Arcade expressions before trying to get the formatted NSString representation of the popup field's value, otherwise it may return an empty string.

Since
100

◆ initWithPopup:

- (instancetype) initWithPopup: (AGSPopup *)  popup

Initializes an AGSPopupManager with an AGSPopup. This initializer will retain the passed in popup strongly. If the AGSGeoElement associated with the popup conforms to AGSLoadable it must be loaded for the AGSPopupManager to work properly.

Since
100

◆ isFieldInFieldGroup:

- (BOOL) isFieldInFieldGroup: (AGSPopupField *)  popupField

Returns a Boolean value indicating whether the given AGSPopupField is part of a AGSFieldGroup, as defined in a AGSContingentValuesDefinition.

Since
100.14

◆ labelForField:

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

Returns a user-friendly display name for the provided popup field

Since
100.3

◆ lengthForField:

- (NSInteger) lengthForField: (AGSPopupField *)  popupField

Returns the field length given an AGSPopupField.

Since
100

◆ numberFromString:field:

- (nullable NSNumber*) numberFromString: (NSString *)  stringValue
field: (AGSPopupField *)  popupField 

Creates correct number type from a string. Uses the AGSPopupField to determine type of number to return (int, double, etc)

Since
100
Deprecated:
100.1. Use numberFromString:field:error: instead.

◆ numberFromString:field:error:

- (nullable NSNumber*) numberFromString: (NSString *)  stringValue
field: (AGSPopupField *)  popupField
error: (NSError **)  error 

Creates correct number type from a string. Uses the AGSPopupField to determine type of number to return (int, double, etc). If the string contains invalid characters it will return nil and fill out the appropriate error. If the string is parsed correctly but the number is out of range for the field's range domain (if there is one) then it will return nil. If the string is parsed correctly but the number is out of numeric range for the appropriate field type then it will return nil and fill out the appropriate error.

Since
100.1

◆ rangeValidationTextForField:

- (nullable NSString*) rangeValidationTextForField: (AGSPopupField *)  popupField

Returns a string that you can display in the UI for informing the user of the valid range for numeric input. Only returns a non-nil value for when there is a range domain associated with the field.

Since
100

◆ startEditing

- (BOOL) startEditing

Starts editing of the popup. This does some work, like copying the original attributes, etc.

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: (AGSPopup) to evaluate the Arcade expressions before trying to get the NSString for templated string, otherwise it may return an empty string.

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

◆ updateFeatureTypeWithTemplate:changeMode:validationError:

- (BOOL) updateFeatureTypeWithTemplate: (nullable AGSFeatureTemplate *)  featureTemplate
changeMode: (AGSPopupFeatureTypeChangeMode changeMode
validationError: (NSError **)  validationError 

Update the feature type of the AGSGeoElement associated with the popup. Returns YES if the new value passes validation.

Since
100

◆ updateValue:field:validationError:

- (BOOL) updateValue: (nullable id)  newValue
field: (AGSPopupField *)  popupField
validationError: (NSError **)  validationError 

Update the value of a field in the AGSGeoElement associated with the popup. This function expects you to pass at least the correct type of value for the field. The only exception to that is that you can pass a string for numeric fields and this function will do the work of converting it to the appropriate number type for the specified field. Returns YES if the new value passes validation.

Since
100

◆ validationErrorForField:

- (nullable NSError*) validationErrorForField: (AGSPopupField *)  popupField

Gets the validation error, if any, currently associated with an AGSPopupField.

Since
100

◆ validationWarningForField:

- (nullable NSError*) validationWarningForField: (AGSPopupField *)  popupField

Gets the validation warning, if any, currently associated with an AGSPopupField.

Since
100

◆ valueForField:

- (nullable id) valueForField: (AGSPopupField *)  popupField

Returns the attribute value for a given field.

If the field is part of an AGSCodedValueDomain, the AGSCodedValue::code is returned (unlike AGSPopup::formattedValueWithPopupField:, which returns the AGSCodedValue::name).

Parameters
popupFieldThe popup field.
Returns
The value of the specified pop-up field.
Since
100

◆ valueForFieldName:popupElement:

- (nullable id) valueForFieldName: (NSString *)  fieldName
popupElement: (AGSPopupElement *)  popupElement 

Returns the attribute value for the field specified by a name.

If any field is using expressions, use evaluateExpressionsWithCompletion: to evaluate the Arcade expressions before trying to get the fields' values. Otherwise, the values may not be evaluated properly.

If the field is part of an AGSCodedValueDomain, the AGSCodedValue::code is returned (unlike formattedValueForField:, which returns the AGSCodedValue::name).

Parameters
fieldNameThe name of the field.
popupElementThe pop-up element to look up for the field. This argument is useful only if the pop-up element is coming from an Arcade expression evaluation that can return a list of attributes (see AGSPopupManager::evaluatedElements).
Since
100.14

Property Documentation

◆ attachmentManager

- (AGSPopupAttachmentManager*) attachmentManager
readnonatomicstrong

The attachment manager for this popup

Since
100

◆ contingencyValidationErrors

- (NSDictionary<NSString *, NSError *>*) contingencyValidationErrors
readnonatomiccopy

A dictionary of field group names and their associated contingent-values validation errors. Errors are reported in validation if editing is defined as restrictive in the AGSFieldGroup.

Since
100.14

◆ contingencyValidationWarnings

- (NSDictionary<NSString *, NSError *>*) contingencyValidationWarnings
readnonatomiccopy

A dictionary of field group names and their associated contingent-values validation warnings. Warnings are reported in validation when editing is defined as non-restrictive in the AGSFieldGroup.

Since
100.14

◆ currentSketchEditor

- (AGSSketchEditor*) currentSketchEditor
readnonatomicstrong

The current sketch editor that is used for editing the geometry of the popup. This is used for the AGSPopupManager to determine when the geometry of the popup being edited changes. This allows the AGSPopupManager to set the validity of the geoElement accordingly.

Since
100

◆ customDescriptionHTML

- (NSString*) customDescriptionHTML
readnonatomiccopy

The text to display as the custom HTML description. If AGSPopupDefinition::expressions is not empty then the custom HTML description may be using expressions with Arcade FeatureSet functions. Use evaluateExpressionsWithCompletion: to evaluate the Arcade expressions before trying to get the AGSPopupManager::customDescriptionHTML, otherwise it may not return the correct description.

Since
100

◆ delegate

- (id<AGSPopupManagerDelegate>) delegate
readwritenonatomicweak

A delegate of the popup manager that is notified about changes in the popup state or validity.

Since
100

◆ displayFields

- (NSArray<AGSPopupField*>*) displayFields
readnonatomiccopy

Convenience for getting the AGSPopupFields that are for viewing

Since
100

◆ editableDisplayFields

- (NSArray<AGSPopupField*>*) editableDisplayFields
readnonatomiccopy

Convenience for getting the popup fields that are editable

Since
100

◆ editing

- (BOOL) editing
readnonatomicassign

Whether or not currently in editing mode

Since
100

◆ editSummary

- (NSString*) editSummary
readnonatomiccopy

The edit summary text.

Since
100

◆ 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 pop-up element, these attributes will be used by formattedValueForField: and valueForField:.

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 pop-up elements in the array matches the order elements present in AGSPopupDefinition::elements and shown in the pop-up 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

◆ featureType

- (AGSFeatureType*) featureType
readnonatomicstrong

The current AGSFeatureType, if any, of the AGSGeoElement

Since
100

◆ geoElementValid

- (BOOL) geoElementValid
readnonatomicassign

A Boolean value indicating whether the geoelement is in a valid state as far as the values it has set in its attributes and its geometry.

Since
100

◆ popup

- (AGSPopup*) popup
readnonatomicunsafe_unretained

The associated AGSPopup. This property is marked unsafe_unretained because it depending on how you instantiate the AGSPopupManager, the AGSPopup you pass in may be retained or not. If the AGSGeoElement associated with the popup conforms to AGSLoadable it must be loaded for the AGSPopupManager to work properly. See the individual initializers for more information.

Since
100

◆ shouldAllowDelete

- (BOOL) shouldAllowDelete
readnonatomicassign

Whether or not the popup view controller should allow deleting. Takes into account if the table allows deleting the feature and the Popup settings. Takes into account OBAC and the popup definition as well.

Since
100

◆ shouldAllowEdit

- (BOOL) shouldAllowEdit
readnonatomicassign

Whether or not the popup view controller should allow editing. Takes into account if it is a new feature. In which case even if allowEdit on the popup is false we still need to show the edit button in the popup if it's a brand new feature. Takes into account OBAC and the popup definition as well.

Since
100

◆ shouldAllowEditAttachments

- (BOOL) shouldAllowEditAttachments
readnonatomicassign

Whether or not the popup view controller should allow editing the attachments. Takes into account the popupDefinition.showAttachments and if we have an attachment manager and if the layer actually has attachments.

Since
100

◆ shouldAllowEditGeometry

- (BOOL) shouldAllowEditGeometry
readnonatomicassign

Whether or not the popup view controller should allow editing the geometry. Takes into account if we are creating a new geometry, if dealing with only a table, etc. Takes into account OBAC and the popup definition as well.

Since
100

◆ shouldShowAttachments

- (BOOL) shouldShowAttachments
readnonatomicassign

Whether or not the popup view controller should show the attachments. Takes into account the popupDefinition.showAttachments and if we have an attachment manager and if the layer actually has attachments.

Since
100

◆ shouldShowCustomDescriptionHTML

- (BOOL) shouldShowCustomDescriptionHTML
readnonatomicassign

Whether or not the popup view controller should show the custom description HTML.

Since
100

◆ shouldShowEditSummary

- (BOOL) shouldShowEditSummary
readnonatomicassign

Whether or not the popup view controller should show the edit info summary.

Since
100

◆ shouldShowMedia

- (BOOL) shouldShowMedia
readnonatomicassign

Whether or not the popup view controller should show the media.

Since
100

◆ symbol

- (AGSSymbol*) symbol
readnonatomicstrong

Symbol used by the popup's geoelement.

Since
100

◆ title

- (NSString*) title
readnonatomiccopy

The text to display as the popup title.

Since
100