`NSUndoManager` is a general-purpose recorder of operations for undo and redo.
Questions tagged [nsundomanager]
222 questions
2
votes
2 answers
How to force NSUndoManager prepareWithInvocationTarget to retain it's arguments?
NSUndoManager method prepareWithInvocationTarget does not retain arguments. There is no links to this in Apple docs, but I've checked with profiler, and I'm pretty sure - it does not. This means if you are going to delete an object and be prepared…

Alexander Vasenin
- 11,437
- 4
- 42
- 70
2
votes
2 answers
NSUndoManager + endUndoGrouping called with no matching begin
I have a Cocoa document-based app and running into some problems with NSUndoManager even though I'm having Core Data take care of all of it.
So every time a new persistent document is created I create a root context and a child context. The root…

schmudu
- 2,111
- 1
- 21
- 30
2
votes
2 answers
How to avoid empty Undo groups in NSUndoManager?
I have been getting empty undo/redo groups in my undoManager undo/redo stacks..Hence getting canUndo/canRedo as TRUE in many cases..
How can this be avoided?

sugeorge
- 21
- 2
2
votes
0 answers
Can I undo actions after I saved the context in core data?
I have a common Core Data app for iOS. Every time something is changed, I call save from the NSManagedContext, so all changes are moved to the database.
As far as I understand, I can only undo changes from the managed context, but not from database.…

Ricardo
- 2,831
- 4
- 29
- 42
2
votes
1 answer
NSUndoManager in non-document based application
I am writing a non-NSDocument-based application similar in style to, say, AddressBook.app. It has a single window located in MainMenu.nib.
Currently, I am struggling with integrating NSUndoManager with this application. If I create an instance of…

tajmahal
- 1,665
- 3
- 16
- 29
2
votes
2 answers
How to use undoManager with a core data entity
I have an NSManagedObject called appointment that I edit the attributes of. If I the user presses cancel I want to reverse all of those edits.
If I do (example code)
[[appointment managedObjectContext] setUndoManager:[[NSUndoManager alloc] init]];…

Bot
- 11,868
- 11
- 75
- 131
2
votes
1 answer
Add an undo/redo method to core graphic draw app
I am trying to implement an undo/redo method using NSUndoManager. I have asked other questions on this, but am still stuck.
Where I am at the moment is as follows:
.h
NSUndoManager *undoManager;
@property(nonatomic,retain) NSUndoManager…

ICL1901
- 7,632
- 14
- 90
- 138
1
vote
0 answers
Undo crash with multiple conditionally rendered TextEditor views
Running the code below in macOS simulator (macOS 12.5.1, Xcode 14.0), I can reproduce an undo-related crash:
Click the "Edit first" button
Edit the (first) input to e.g. "helloo"
Click the "Edit second" button
Click "Undo" in the "Edit" menu, or…

bzyr
- 289
- 1
- 11
1
vote
0 answers
Quickest way to dirty a FileReferenceDocument in SwiftUI for macOS
I have a number of changes to a document-based application which are not undoable (conceptually, think quiz progress) but which should dirty the document so the state is saved when the user quits or closes the document.
Apple's documentation for…

green_knight
- 1,319
- 14
- 26
1
vote
1 answer
UndoManager persistence in iOS
I want to implement undo/redo operations in my app. The undo/redo actions need to be recorded for every document rather than at UIViewController level. So I will need to put UndoManager in the class implementing custom document. But one of the…

Deepak Sharma
- 5,577
- 7
- 55
- 131
1
vote
1 answer
SwiftUI UndoManager — how does it work and isn't it working?
I'm trying to learn how UndoManager works. I made a small app to Undo/Redo something.
And I have few questions, I cannot find answer in documentation:
I know UndoManager could be accessed in View via
@Environment(\.undoManager) var…

Łukasz
- 773
- 5
- 23
1
vote
1 answer
UITextView and NSUndoManager synchronisation
I have tried to search first but couldn't find exactly what I need.
I have one UITextView and I have buttons that are executing actions undo and redo on UITextViews NSUndoManager so that part is working but here comes the problem. Undo actions are…

Amar Kulo
- 1,098
- 8
- 18
1
vote
1 answer
Alert with Shake to Undo
I want to implement a shake to undo on my iPhone App, in Swift.
For now it works, but it didn't display an Alert asking to validate the undo gesture (with buttons "Cancel" and "Undo"). I can add this alert in the right place myself, but I'm not…

FredericP
- 1,119
- 1
- 14
- 27
1
vote
1 answer
How to undo UITextField edits in Swift
I'm sure there's a simple answer to this, but I'm pretty noob to programming and have searched extensively here and on the few Undo tutorials I could find.
I have two buttons and a UITextField with a number in it. The buttons increment the number in…

LWT
- 11
- 1
1
vote
1 answer
Undo/Redo Menu Items Never Enabled
I have a core data application with an NSTableView bound to an NSArrayController. I manage adding and removing objects using the array controller. I'm trying to add undo/redo support so when a person deletes an object from the table view, using a…

Jon Buys
- 507
- 5
- 15