Metadata Class Reference
- Last UpdatedJul 15, 2025
- 3 minute read
public class Metadata
extension Metadata: NativeBase
extension Metadata: Hashable
Holds metadata on behalf of a map item. An instance of this class can contain metadata items of varying types, such as String, Integer, Double, GeoCoordinates etc. and can also hold arbitrary metadata types by the use of the CustomMetadataValue protocol.
-
Creates an instance of this class.
Declaration
Swift
public init()
-
Obtains an instance of the CustomMetadataValue class associated with a given key.
Declaration
Swift
public func getCustomValue(key: String) -> CustomMetadataValue?
Parameters
key
The name of the key for which to obtain the value.
Return Value
The value associated with the key.
-
Obtains a Double value associated with a given key.
Declaration
Swift
public func getDouble(key: String) -> Double?
Parameters
key
The name of the key for which to obtain the value.
Return Value
The value associated with the key.
-
Obtains a GeoCoordinates value associated with a given key.
Declaration
Swift
public func getGeoCoordinates(key: String) -> GeoCoordinates?
Parameters
key
The name of the key for which to obtain the value.
Return Value
The value associated with the key.
-
Obtains an Integer value associated with a given key.
Declaration
Swift
public func getInteger(key: String) -> Int32?
Parameters
key
The name of the key for which to obtain the value.
Return Value
The value associated with the key.
-
Obtains a String value associated with a given key.
Declaration
Swift
public func getString(key: String) -> String?
Parameters
key
The name of the key for which to obtain the value.
Return Value
The value associated with the key.
-
Determines the type of a metadata value. If the type of a metadata value associated with a key is not known, this method will enable the type to be queried, in order to know which get method to call. i.e. getDouble(), getInteger() etc.
Declaration
Swift
public func getType(key: String) -> MetadataType?
Parameters
key
The name of the key for which to obtain the type.
Return Value
An enumeration describing the type of the value associated with the key.
-
Removes a metadata key and its associated value.
Declaration
Swift
public func removeValue(key: String)
Parameters
key
The name of the key to be removed.
-
Creates a key:value pair, where the value is a type derived from CustomMetadataValue. If the given key already exists, its value will be replaced by the new one.
Declaration
Swift
public func setCustomValue(key: String, value: CustomMetadataValue)
Parameters
key
The name of the key to be created or replaced.
value
The value to be assigned to the key.
-
Creates a key:value pair, where the value is of type Double. If the given key already exists, its value will be replaced by the new one.
Declaration
Swift
public func setDouble(key: String, value: Double)
Parameters
key
The name of the key to be created or replaced.
value
The value to be assigned to the key.
-
Creates a key:value pair, where the value is of type GeoCoordinates. If the given key already exists, its value will be replaced by the new one.
Declaration
Swift
public func setGeoCoordinates(key: String, value: GeoCoordinates)
Parameters
key
The name of the key to be created or replaced.
value
The value to be assigned to the key.
-
Creates a key:value pair, where the value is of type Integer. If the given key already exists, its value will be replaced by the new one.
Declaration
Swift
public func setInteger(key: String, value: Int32)
Parameters
key
The name of the key to be created or replaced.
value
The value to be assigned to the key.
-
Creates a key:value pair, where the value is of type String. If the given key already exists, its value will be replaced by the new one.
Declaration
Swift
public func setString(key: String, value: String)
Parameters
key
The name of the key to be created or replaced.
value
The value to be assigned to the key.