CoatyObject

open class CoatyObject : Codable

The base type of all objects in the Coaty object model. Application-specific object types extend either CoatyObject directly or any of its derived core types.

Class registration.

  • Undocumented

    Declaration

    Swift

    open class var objectType: String { get }

Required attributes.

  • The framework core type of the object, i.e. the name of the interface that defines the object’s shape.

    Declaration

    Swift

    public var coreType: CoreType
  • The concrete type name of the object.

    The name should be in a canonical form following the naming convention for Java packages to avoid name collisions. All framework core types use the form coaty., e.g. “coaty.CoatyObject”.

    Note

    Object type names should be made up of characters in the range 0 to 9, a to z, A to Z, and dot (.).

    Note

    All object types starting with “coaty.” are reserved for use by the Coaty framework and must not be used by applications to define custom object types.

    Declaration

    Swift

    public var objectType: String
  • Unique ID of the object.

    Declaration

    Swift

    public var objectId: CoatyUUID
  • The name/description of the object.

    Declaration

    Swift

    public var name: String

Optional attributes.

  • External ID associated with this object (optional).

    Declaration

    Swift

    public var externalId: String?
  • Unique ID of parent/superordinate object (optional).

    Declaration

    Swift

    public var parentObjectId: CoatyUUID?
  • Unique ID of Location object that this object has been associated with (optional).

    Declaration

    Swift

    public var locationId: CoatyUUID?
  • Marks an object that is no longer in use.

    The concrete definition meaning of this property is defined by the application. The property value is optional and should default to false.

    Declaration

    Swift

    public var isDeactivated: Bool?
  • Holds all custom properties of a non-registered object type that is decoded as part of an incoming communication event.

    For any custom object type that has not been registered, this dictionary holds all custom fields that are not defined by the core type of this Coaty object.

    Note

    For registered custom object types (and core types), this dictionary is always empty.

    Note

    This property is never encoded. It is only intended to be accessed inside your local app.

    Declaration

    Swift

    internal(set) public var custom: [String : Any] { get }

Initializers.

Static and instance registration methods.

  • Register the given Coaty object type with the implementing Swift class type.

    Declaration

    Swift

    public static func register(objectType: String, with classType: CoatyObject.Type) -> String
  • Determines whether this Coaty object has been registered by its object type. If true is returned, all core type properties and non-core type properties of this object are accessible. Otherwise, non-core type values are accessible in the custom dictionary property.

    Declaration

    Swift

    public var isObjectTypeRegistered: Bool { get }

Codable methods.

  • Declaration

    Swift

    public required init(from decoder: Decoder) throws
  • Declaration

    Swift

    open func encode(to encoder: Encoder) throws

Extension enable easy access to JSON representation of Coaty object.

  • Undocumented

    Declaration

    Swift

    public var json: String { get }