ARTAnnotation

Objective-C

@interface ARTAnnotation : NSObject<NSCopying>

/// A Unique ID assigned by Ably to this message.
@property (nullable, readonly, nonatomic) NSString *id;

/// The action, whether this is an annotation being added or removed, one of the `ARTAnnotationAction` enum values.
@property (readonly, nonatomic) ARTAnnotationAction action;

/// The client ID of the publisher of this message.
@property (nonatomic, readonly, nullable) NSString *clientId;

/// The name of this annotation. This is the field that most annotation aggregations will operate on. For example, using "distinct.v1" aggregation (specified in the type), the message summary will show a list of clients who have published an annotation with each distinct annotation.name.
@property (nullable, readonly, nonatomic) NSString *name;

/// An optional count, only relevant to certain aggregation methods, see aggregation methods documentation for more info.
@property (nullable, readonly, nonatomic) NSNumber *count;

/// The message payload, if provided.
@property (nonatomic, readonly, nullable) id data;

/// This is typically empty, as all messages received from Ably are automatically decoded client-side using this value. However, if the message encoding cannot be processed, this attribute contains the remaining transformations not applied to the `data` payload.
@property (nonatomic, readonly, nullable) NSString *encoding;

/// Timestamp of when the message was received by Ably, as a `NSDate` object.
@property (nullable, nonatomic, readonly) NSDate *timestamp;

/// This annotation's unique serial (lexicographically totally ordered).
@property (readonly, nonatomic) NSString *serial;

/// The serial of the message (of type `MESSAGE_CREATE`) that this annotation is annotating.
@property (readonly, nonatomic) NSString *messageSerial;

/// The type of annotation it is, typically some identifier together with an aggregation method; for example: "emoji:distinct.v1". Handled opaquely by the SDK and validated serverside.
@property (readonly, nonatomic) NSString *type;

/// A JSON object of arbitrary key-value pairs that may contain metadata, and/or ancillary payloads.
@property (nullable, readonly, nonatomic) id<ARTJsonCompatible> extras;

- (instancetype)initWithId:(nullable NSString *)annotationId
                    action:(ARTAnnotationAction)action
                  clientId:(nullable NSString *)clientId
                      name:(nullable NSString *)name
                     count:(nullable NSNumber *)count
                      data:(nullable id)data
                  encoding:(nullable NSString *)encoding
                 timestamp:(NSDate *)timestamp
                    serial:(NSString *)serial
             messageSerial:(NSString *)messageSerial
                      type:(NSString *)type
                    extras:(nullable id<ARTJsonCompatible>)extras;
@end

Swift

class ARTAnnotation : NSObject, NSCopying, @unchecked Sendable

Undocumented

  • id

    A Unique ID assigned by Ably to this message.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *id;

    Swift

    var id: String? { get }
  • The action, whether this is an annotation being added or removed, one of the ARTAnnotationAction enum values.

    Declaration

    Objective-C

    @property (nonatomic, readonly) ARTAnnotationAction action;

    Swift

    var action: ARTAnnotationAction { get }
  • The client ID of the publisher of this message.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *clientId;

    Swift

    var clientId: String? { get }
  • The name of this annotation. This is the field that most annotation aggregations will operate on. For example, using “distinct.v1” aggregation (specified in the type), the message summary will show a list of clients who have published an annotation with each distinct annotation.name.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *name;

    Swift

    var name: String? { get }
  • An optional count, only relevant to certain aggregation methods, see aggregation methods documentation for more info.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSNumber *count;

    Swift

    var count: NSNumber? { get }
  • The message payload, if provided.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) id data;

    Swift

    var data: Any? { get }
  • This is typically empty, as all messages received from Ably are automatically decoded client-side using this value. However, if the message encoding cannot be processed, this attribute contains the remaining transformations not applied to the data payload.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *encoding;

    Swift

    var encoding: String? { get }
  • Timestamp of when the message was received by Ably, as a NSDate object.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSDate *timestamp;

    Swift

    var timestamp: Date? { get }
  • This annotation’s unique serial (lexicographically totally ordered).

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSString *_Nonnull serial;

    Swift

    var serial: String { get }
  • The serial of the message (of type MESSAGE_CREATE) that this annotation is annotating.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSString *_Nonnull messageSerial;

    Swift

    var messageSerial: String { get }
  • The type of annotation it is, typically some identifier together with an aggregation method; for example: “emoji:distinct.v1”. Handled opaquely by the SDK and validated serverside.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSString *_Nonnull type;

    Swift

    var type: String { get }
  • A JSON object of arbitrary key-value pairs that may contain metadata, and/or ancillary payloads.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) id<ARTJsonCompatible> extras;

    Swift

    var extras: (any ARTJsonCompatible)? { get }
  • Undocumented

    Declaration

    Objective-C

    - (instancetype)initWithId:(nullable NSString *)annotationId
                        action:(ARTAnnotationAction)action
                      clientId:(nullable NSString *)clientId
                          name:(nullable NSString *)name
                         count:(nullable NSNumber *)count
                          data:(nullable id)data
                      encoding:(nullable NSString *)encoding
                     timestamp:(NSDate *)timestamp
                        serial:(NSString *)serial
                 messageSerial:(NSString *)messageSerial
                          type:(NSString *)type
                        extras:(nullable id<ARTJsonCompatible>)extras;

    Swift

    init(id annotationId: String?, action: ARTAnnotationAction, clientId: String?, name: String?, count: NSNumber?, data: Any?, encoding: String?, timestamp: Date, serial: String, messageSerial: String, type: String, extras: (any ARTJsonCompatible)?)
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL isIdEmpty

    Swift

    var isIdEmpty: Bool { get }
  • Undocumented

    Declaration

    Objective-C

    - (id)decodeWithEncoder:(ARTDataEncoder *)encoder error:(NSError *__nullable*__nullable)error;

    Swift

    func decode(with encoder: ARTDataEncoder, error: NSErrorPointer) -> Any
  • Undocumented

    Declaration

    Objective-C

    - (id)encodeWithEncoder:(ARTDataEncoder *)encoder error:(NSError *__nullable*__nullable)error;

    Swift

    func encode(with encoder: ARTDataEncoder, error: NSErrorPointer) -> Any