AttributesEditor
public final class AttributesEditor
Attributes editor.
-
Removes an attribute.
Declaration
Swift
public func remove(_ attribute: String)Parameters
attributeThe attribute.
-
Sets the attribute.
Declaration
Swift
public func set(date: Date, attribute: String)Parameters
dateThe value
attributeThe attribute
-
Sets the attribute.
Declaration
Swift
@available(*, deprecated, message: "Use set(number:number﹚ with Double type instead") public func set(number: NSNumber, attribute: String)Parameters
numberThe value.
attributeThe attribute.
-
Sets the attribute.
Declaration
Swift
public func set(number: Double, attribute: String)Parameters
numberThe value.
attributeThe attribute.
-
Sets the attribute.
Declaration
Swift
public func set(number: Int, attribute: String)Parameters
numberThe value.
attributeThe attribute.
-
Sets the attribute.
Declaration
Swift
public func set(number: UInt, attribute: String)Parameters
numberThe value.
attributeThe attribute.
-
Sets the attribute.
Declaration
Swift
public func set(string: String, attribute: String)Parameters
stringThe value.
attributeThe attribute.
-
Sets a custom attribute with a JSON payload and optional expiration.
Throws
Throws:
AirshipErrors.errorif:- The expiration is invalid (more than 731 days or not in the future).
- The input
jsonis empty. - The JSON contains a top-level
"exp"key (reserved for expiration). - The attribute contains
"#"or is empty - The instanceID contains
"#"or is empty
Declaration
Swift
public func set( json: [String: AirshipJSON], attribute: String, instanceID: String, expiration: Date? = nil ) throwsParameters
jsonA dictionary of key-value pairs (
[String: AirshipJSON]) representing the custom payload.attributeThe name of the attribute to be set.
instanceIDAn identifier used to differentiate instances of the attribute.
expirationAn optional expiration
Date. If provided, it must be greater than 0 and less than or equal to 731 days from now. -
Removes a JSON attribute.
- attribute: The name of the attribute to be set.
instanceID: An identifier used to differentiate instances of the attribute.
Throws
AirshipErrors.errorif:- The attribute contains
"#"or is empty - The instanceID contains
"#"or is empty
- The attribute contains
Declaration
Swift
public func remove(attribute: String, instanceID: String) throws -
Sets the attribute.
Declaration
Swift
public func set(float: Float, attribute: String)Parameters
floatThe value.
attributeThe attribute.
-
Sets the attribute.
Declaration
Swift
public func set(double: Double, attribute: String)Parameters
doubleThe value.
attributeThe attribute.
-
Sets the attribute.
Declaration
Swift
public func set(int: Int, attribute: String)Parameters
intThe value.
attributeThe attribute.
-
Sets the attribute.
Declaration
Swift
public func set(uint: UInt, attribute: String)Parameters
uintThe value.
attributeThe attribute.
-
Applies the attribute changes.
Declaration
Swift
public func apply()
View on GitHub