UndoManager.UserInfoKey
An extensible namespace for undo and redo user info keys.
Declaration
struct UserInfoKeyDiscussion
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)