Created
December 8, 2015 16:01
-
-
Save MattyAyOh/71b640cf88cc4e059927 to your computer and use it in GitHub Desktop.
Log out the undo and redo stack on an NSUndoManager using objc/runtime to access private ivars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@try | |
{ | |
NSUndoManager* undoManager = [self undoManager]; | |
id undostack = object_getIvar(undoManager, class_getInstanceVariable([NSUndoManager class], "_undoStack")); | |
id redostack = object_getIvar(undoManager, class_getInstanceVariable([NSUndoManager class], "_redoStack")); | |
NSLog(@"%@",[NSString stringWithFormat:@"(%lu entries) %@", (unsigned long)[undostack count], [undostack description]]); | |
NSLog(@"%@",[NSString stringWithFormat:@"(%lu entries) %@", (unsigned long)[redostack count], [redostack description]]); | |
} | |
@catch (NSException* e) | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For Swift: