I created a sample app that is minimal for undoManager: GitHub - kissferenc/WillUndoRedoBug
This project created on the new Xcode 14.3 and minimum deployments are iOS 16.4 and macOS 13.3. These are on the latest version.
The program will log out the undoManager notifications and the value changes.
On macOS the order is correct when I'm undoing or redoing:
After undo logs:
[changeValue] willUndo
[setValue] [setValue] before set oldValue: 12, newValue: 11
[setValue] [setValue] after set oldValue: 12, newValue: 11
[changeValue] didUndo
After redo logs:
[changeValue] willRedo
[setValue] [setValue] before set oldValue: 11, newValue: 12
[setValue] [setValue] after set oldValue: 11, newValue: 12
[changeValue] didRedo
But on iOS the logs appear in wrong order:
After undo logs:
[setValue] [setValue] before set oldValue: 12, newValue: 11
[setValue] [setValue] after set oldValue: 12, newValue: 11
[changeValue] willUndo
[changeValue] didUndo
After redo logs:
[setValue] [setValue] before set oldValue: 11, newValue: 12
[setValue] [setValue] after set oldValue: 11, newValue: 12
[changeValue] willRedo
[changeValue] didRedo
Is this a bug or I missed something?