GLMapValue

Objective-C


@interface GLMapValue : NSObject

Swift

class GLMapValue : NSObject

GLMapValue is a class that hold some value and can convert it to Obj-C or Swift value

  • 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 value to float, or NAN on failure.

    Declaration

    Objective-C

    - (CGFloat)asFloat;

    Swift

    func asFloat() -> CGFloat

    Return Value

    Float value

  • Converts value to string.

    Declaration

    Objective-C

    - (NSString *_Nullable)asString;

    Swift

    func asString() -> String?

    Return Value

    String value

  • Converts value to bool.

    Declaration

    Objective-C

    - (BOOL)asBool;

    Swift

    func asBool() -> Bool

    Return Value

    Bool value

  • Converts value to color

    Declaration

    Objective-C

    - (PlatformColor *_Nullable)asColor;

    Swift

    func asColor() -> NSColor?

    Return Value

    Color value or nil on failure

  • Converts value to map color

    Declaration

    Objective-C

    - (GLMapColor)asMapColor;

    Swift

    func asMapColor() -> GLMapColor

    Return Value

    Color value or color with alpha = 0 on failure

  • Used for values returned by offline search. When part of value is matched during search, this functions returns NSAttributedString with higlighted parts.

    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

    Name value with highlighted parts

  • Calculates stable hash for 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