GLMapValue

Objective-C


@interface GLMapValue : NSObject

Swift

class GLMapValue : NSObject

GLMapValue holds a typed value and provides conversions to Objective‑C types.

  • Initialize value with string.

    Declaration

    Objective-C

    - (instancetype _Nonnull)initWithString:(NSString *_Nonnull)string;

    Swift

    init(string: String)
  • Initialize value with color.

    Declaration

    Objective-C

    - (instancetype _Nonnull)initWithColor:(GLMapColor)color;

    Swift

    init(color: GLMapColor)
  • Converts the value to a float, or NAN on failure.

    Declaration

    Objective-C

    - (CGFloat)asFloat;

    Swift

    func asFloat() -> CGFloat

    Return Value

    Float value.

  • Converts the value to a string.

    Declaration

    Objective-C

    - (NSString *_Nullable)asString;

    Swift

    func asString() -> String?

    Return Value

    String value.

  • Converts the value to a boolean.

    Declaration

    Objective-C

    - (BOOL)asBool;

    Swift

    func asBool() -> Bool

    Return Value

    Boolean value.

  • Converts the value to a platform color.

    Declaration

    Objective-C

    - (PlatformColor *_Nullable)asColor;

    Swift

    func asColor() -> NSColor?

    Return Value

    Color value, or nil on failure.

  • Converts the value to GLMapColor.

    Declaration

    Objective-C

    - (GLMapColor)asMapColor;

    Swift

    func asMapColor() -> GLMapColor

    Return Value

    Color value, or a fully transparent color on failure.

  • Used for values returned by offline search. When part of the value is matched during search, this returns an NSAttributedString with highlighted matches.

    Declaration

    Objective-C

    - (NSAttributedString *_Nullable)
        asAttributedString:(NSDictionary *_Nonnull)normalAttributes
                 highlight:(NSDictionary *_Nonnull)highlightAttributes;

    Swift

    func asAttributedString(_ normalAttributes: [AnyHashable : Any], highlight highlightAttributes: [AnyHashable : Any]) -> NSAttributedString?

    Parameters

    normalAttributes

    Normal attributes.

    highlightAttributes

    Highlight attributes.

    Return Value

    Value with highlighted matches, or nil if formatting is not available.

  • Calculates a stable hash for a string.

    Declaration

    Objective-C

    + (uint32_t)calcFastHash:(NSString *_Nonnull)string;

    Swift

    class func calcFastHash(_ string: String) -> UInt32

    Parameters

    string

    Input string.

    Return Value

    Calculated hash.