Contents

redoActionUserInfoValue(forKey:)

Retrieves the redo action’s user info value for the given key.

Declaration

func redoActionUserInfoValue(forKey key: UndoManager.UserInfoKey) -> Any?

Parameters

  • key:

    The key associated with the value to return.

Return Value

The value that you previously registered to this key with setActionUserInfoValue(_:forKey:), or nil if the key is absent.

Discussion

Use this method to retrieve a user info value for the redo action you previously set with setActionUserInfoValue(_:forKey:).

In this example, an app’s redoButton() method provides a SwiftUI view that incorporates a previously assigned icon for the action:

func redoButton() -> some SwiftUI.View {
    Button(action: {
        self.undoManager.redo()
    }) {
        Label(self.undoManager.redoActionName,
              image: self.undoManager.redoActionUserInfoValue(forKey: .icon) as? Image)
    }
}

See Also

Working with user info