AWFGroupedStyle

Objective-C

@interface AWFGroupedStyle : NSObject <AWFStyleProvider>

Swift

class AWFGroupedStyle : NSObject, AWFStyleProvider

AWFGroupedStyle is responsible for managing multiple instances of AWFMapItemStyle that are categorized based on certain criteria found within the model instance associated with a map item.

  • A dictionary containing the available styles keyed by their group types.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSDictionary<NSString *, T> *_Nonnull styles;

    Swift

    var styles: [String : AWFMapItemStyle] { get }
  • A dictionary containing the label titles to use for each style in the group keyed by their group types.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSDictionary<NSString *, NSString *> *labels;

    Swift

    var labels: [String : String]? { get }
  • An array of group type keys that defines the order in which the items in the group are rendered, especially within a legend view.

    Declaration

    Objective-C

    @property (nonatomic, strong) NSArray<NSString *> *_Nonnull order;

    Swift

    var order: [String] { get set }
  • Initializes and returns a grouped style instance with the specified array of styles and title labels.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithStyles:
        (nonnull NSDictionary<NSString *, T> *)styles;

    Swift

    init(styles: [String : AWFMapItemStyle])

    Parameters

    styles

    The styles to use

    Return Value

    An AWFGroupedStyle initialized with the styles and labels

  • Returns the style associated with the group identifier, if any.

    Declaration

    Objective-C

    - (nullable T)styleForIdentifier:(nonnull NSString *)identifier;

    Swift

    func style(forIdentifier identifier: String) -> AWFMapItemStyle?

    Parameters

    identifier

    The identifier of the group to return the style for

  • Sets the style for the specified group identifier.

    Declaration

    Objective-C

    - (void)setStyle:(nullable T)style forIdentifier:(nonnull NSString *)identifier;

    Swift

    func setStyle(_ style: AWFMapItemStyle?, forIdentifier identifier: String)

    Parameters

    style

    The style to use for the group

    identifier

    The group identifier to associate the style with

  • Returns the label associated with the group identifier, if any.

    Declaration

    Objective-C

    - (nullable NSString *)labelForIdentifier:(nonnull NSString *)identifier;

    Swift

    func label(forIdentifier identifier: String) -> String?

    Parameters

    identifier

    The identifier of the group to return the label for

  • Sets the label for the specified group identifier. The label is typically used when displaying legends for the map layer associated with this group.

    Declaration

    Objective-C

    - (void)setLabel:(nullable NSString *)label
        forIdentifier:(nonnull NSString *)identifier;

    Swift

    func setLabel(_ label: String?, forIdentifier identifier: String)

    Parameters

    label

    The label to use for the group

    identifier

    The group identifier to associate the label with

  • Returns the group identifier for the specified model object.

    Models are evaluated according to the blocks provided with setModelEvaluatorBlocks:. If no blocks have been defined for this group, then no identifier will be returned for the model instance.

    Declaration

    Objective-C

    - (nullable NSString *)identifierForModel:(id)model;

    Swift

    func identifier(forModel model: Any!) -> String?

    Parameters

    model

    The model instance to return the group identifier for

    Return Value

    The group identifier for the model, if any

  • Returns the map item style for the specified model instance based on the model’s evaluated group identifier.

    Declaration

    Objective-C

    - (nullable T)styleForModel:(id)model;

    Swift

    func style(forModel model: Any!) -> AWFMapItemStyle?

    Parameters

    model

    The model instance to return the style for

    Return Value

    The style associated with the model instance, if any

  • Sets the evaluator blocks to use when determining the group identifier associated with model instances.

    The value provided for blocks must be a dictionary of AWFModelIdentifierEvaluator blocks keyed by their group identifier that return a Boolean value whether or not the model instance meets the criteria for that group.

    Declaration

    Objective-C

    - (void)setModelEvaluatorBlocks:
        (nonnull NSDictionary<NSString *, AWFModelIdentifierEvaluator> *)blocks;

    Swift

    func setModelEvaluatorBlocks(_ blocks: [String : (Any) -> Bool])

    Parameters

    blocks

    The dictionary of evaluator blocks keyed by group identifier