Documentation Language: Swift

Class

AddCommand

Command to add a value to a many-valued structural feature.

@MainActor final class AddCommand

Overview

AddCommand adds an element to a collection-valued feature on an EObject, supporting both ordered and unordered collections with proper undo capability.

Example Usage

let command = AddCommand(
    object: company,
    feature: employeesReference,
    value: newEmployee
)

try await command.execute()
try await command.undo() // Removes the added employee

Topics

Initializers

?
init(object:feature:value:)

Creates a new add command.

Instance Properties

V
canRedo

Indicates whether the command can be redone after being undone.

V
canUndo

Indicates whether the command can be undone.

V
description

A human-readable description of the command.

V
feature

The many-valued feature to add to.

V
objectId

The object to modify.

V
value

The value to add.

Instance Methods

F
execute()

Execute the command, applying its changes to the model.

F
redo()

Redo the command, re-applying its changes after undo.

F
undo()

Undo the command, reversing its changes to the model.

Relationships

Inherits From

Conforms To