AttributesEditor

public final class AttributesEditor

Attributes editor.

  • Removes an attribute.

    Declaration

    Swift

    public func remove(_ attribute: String)

    Parameters

    attribute

    The attribute.

  • Sets the attribute.

    Declaration

    Swift

    public func set(date: Date, attribute: String)

    Parameters

    date

    The value

    attribute

    The 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

    number

    The value.

    attribute

    The attribute.

  • Sets the attribute.

    Declaration

    Swift

    public func set(number: Double, attribute: String)

    Parameters

    number

    The value.

    attribute

    The attribute.

  • Sets the attribute.

    Declaration

    Swift

    public func set(number: Int, attribute: String)

    Parameters

    number

    The value.

    attribute

    The attribute.

  • Sets the attribute.

    Declaration

    Swift

    public func set(number: UInt, attribute: String)

    Parameters

    number

    The value.

    attribute

    The attribute.

  • Sets the attribute.

    Declaration

    Swift

    public func set(string: String, attribute: String)

    Parameters

    string

    The value.

    attribute

    The attribute.

  • Sets a custom attribute with a JSON payload and optional expiration.

    Throws

    Throws:

    • AirshipErrors.error if:
    • The expiration is invalid (more than 731 days or not in the future).
    • The input json is 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
    ) throws

    Parameters

    json

    A dictionary of key-value pairs ([String: AirshipJSON]) representing the custom payload.

    attribute

    The name of the attribute to be set.

    instanceID

    An identifier used to differentiate instances of the attribute.

    expiration

    An 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.error if:

      • The attribute contains "#"or is empty
      • The instanceID contains "#"or is empty

    Declaration

    Swift

    public func remove(attribute: String, instanceID: String) throws
  • Sets the attribute.

    Declaration

    Swift

    public func set(float: Float, attribute: String)

    Parameters

    float

    The value.

    attribute

    The attribute.

  • Sets the attribute.

    Declaration

    Swift

    public func set(double: Double, attribute: String)

    Parameters

    double

    The value.

    attribute

    The attribute.

  • Sets the attribute.

    Declaration

    Swift

    public func set(int: Int, attribute: String)

    Parameters

    int

    The value.

    attribute

    The attribute.

  • Sets the attribute.

    Declaration

    Swift

    public func set(uint: UInt, attribute: String)

    Parameters

    uint

    The value.

    attribute

    The attribute.

  • Applies the attribute changes.

    Declaration

    Swift

    public func apply()