Contents

UndoManager.UserInfoKey

An extensible namespace for undo and redo user info keys.

Declaration

struct UserInfoKey

Discussion

Extend this type with the names of user info keys you want to associate with undo actions, like this:

extension UndoManager.UserInfoKey {
    static let icon: UndoManager.UserInfoKey = "icon"
}

You then use this key when you set and get undo user info values.

self.undoManager.setActionUserInfoValue(Image(named: "new_layer"), forKey: .icon)

Topics

Creating a user info key from a raw value

See Also

Working with user info