DittoMutableRGA

public class DittoMutableRGA

Represents a mutable CRDT Replicated Growable Array (RGA) that can be updated as part of updating a document.

This class can’t be instantiated directly. It’s returned automatically for any RGA property within an update block.

See also the rga property of DittoMutableDocumentPath.

  • The value that is stored in the register.

    Declaration

    Swift

    @available(*, deprecated, message: "DittoRGA usage should be replaced. Use arrays inside DittoRegisters instead")
    public var value: [Any?] { get }

Mutation functions

  • Set a value at the specified index.

    Declaration

    Swift

    @available(*, deprecated, message: "DittoRGA usage should be replaced. Use arrays inside DittoRegisters instead")
    public func set(value: Any?, atIndex index: Int)

    Parameters

    value

    The value to set at the specified index.

    index

    The index at which to set the provided value.

  • Remove a value at the specified index.

    Declaration

    Swift

    @available(*, deprecated, message: "DittoRGA usage should be replaced. Use arrays inside DittoRegisters instead")
    public func remove(atIndex index: Int)

    Parameters

    index

    The index of the element to remove.

  • Push a value on to the end of the RGA.

    Declaration

    Swift

    @available(*, deprecated, message: "DittoRGA usage should be replaced. Use arrays inside DittoRegisters instead")
    public func push(_ value: Any?)

    Parameters

    value

    The value to push on to the RGA.

  • Pop a value off the end of the RGA.

    Declaration

    Swift

    @available(*, deprecated, message: "DittoRGA usage should be replaced. Use arrays inside DittoRegisters instead")
    public func pop() -> Any?

    Return Value

    The value popped off from the end of the RGA.

  • Inserts a value into the RGA at the index specified.

    Declaration

    Swift

    @available(*, deprecated, message: "DittoRGA usage should be replaced. Use arrays inside DittoRegisters instead")
    public func insert(_ value: Any?, atIndex index: Int)

    Parameters

    value

    The value to insert into the RGA.

    index

    The index at which to insert the provided value.