DriverAttributes
@objc
public class DriverAttributes : NSObject, NSCopying
Additional attributes of a Zendrive driver.
The application can specify both predefined and custom attributes for a driver. These attributes are associated with a SDK driverId at SDK initialization time. In addition to predefined special attributes, up to 4 custom key value attributes can be associated with a driver using the Zendrive SDK.
Warning
All attribute keys can be atmost 64 characters in length.Warning
All attribute values can be atmost 1024 characters in length.-
A unique id that associates the current user to a group. This groupId will be made available as a query parameter to filter users in the reports and API that
Zendriveprovides.For example, ‘EastCoast’ and ‘WestCoast’ can be groupIds to distinguish users from these regions. Another example would be using city names as groupIds. Check
Zendrive.isValidInputParameter(_:)method to validate group id. Setting an invalid groupId is a no-op and would log an error.Declaration
Swift
@objc public func setGroup(_ groupId: String) -> BoolParameters
groupIdA string representing the group of a user.
Return Value
true, if the value was set,falseotherwise. -
The service level of a driver. This is useful for applications where
Zendrivesupports different service levels for different drivers. See ServiceLevel for more information about this attribute.Declaration
Swift
@objc public func setServiceLevel(_ serviceLevel: ServiceLevel) -> BoolParameters
serviceLevelservice tier of the user.
-
Set the custom attribute of the user.
Up to 4 custom attributes can be set for a user. A new value for an existing key would be overwritten only if the value length is within 1024 characters, otherwise the original value would be retained.
Declaration
Swift
@objc public func setCustomAttribute(_ value: String, forKey key: String) -> BoolParameters
keyA key for the custom attribute. The maximum key length is 64 characters.
valueValue of the custom attribute. The maximum value length is 1024 characters.
Return Value
true, if the value was set,falseotherwise. -
Alias is a string placeholder offered as a convenience for developers to create a reference for a driver
Declaration
Swift
@objc public func setAlias(_ alias: String) -> BoolParameters
aliasservice tier of the user.
Return Value
true, if the value was set,falseotherwise. -
Returns driver attributes as a json string. Empty string if json serialization fails.
Declaration
Swift
@objc public func asJson() -> String -
Returns the driver attributes as a dictionary.
Declaration
Swift
@objc public func asDictionary() -> [AnyHashable : Any] -
NSCopying protocol confirmance
Declaration
Swift
@objc public func copy(with zone: NSZone? = nil) -> Any -
Creates a
DriverAttributesobject.Declaration
Swift
@objc public override convenience init()
DriverAttributes Class Reference