{"id":22353704,"url":"https://github.com/rosberry/rsbundomanager","last_synced_at":"2025-09-10T07:42:08.490Z","repository":{"id":62452175,"uuid":"100699794","full_name":"rosberry/RSBUndoManager","owner":"rosberry","description":"Lightweight helper with keyPath-based undo registration","archived":false,"fork":false,"pushed_at":"2017-08-25T07:51:28.000Z","size":34,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-30T08:16:27.215Z","etag":null,"topics":["ios","objective-c","redo","undo"],"latest_commit_sha":null,"homepage":"https://rosberry.com","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rosberry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-18T10:07:11.000Z","updated_at":"2020-04-15T03:59:39.000Z","dependencies_parsed_at":"2022-11-01T23:34:26.418Z","dependency_job_id":null,"html_url":"https://github.com/rosberry/RSBUndoManager","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosberry%2FRSBUndoManager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosberry%2FRSBUndoManager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosberry%2FRSBUndoManager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosberry%2FRSBUndoManager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rosberry","download_url":"https://codeload.github.com/rosberry/RSBUndoManager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228114885,"owners_count":17871742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","objective-c","redo","undo"],"created_at":"2024-12-04T13:09:30.695Z","updated_at":"2024-12-04T13:09:31.387Z","avatar_url":"https://github.com/rosberry.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RSBUndoManager\n\nRSBUndoManager is a lightweight helper with keyPath-based undo registration and simple memory management; built on top of NSUndoManager.\n\n## Usage\n\nPrepare an instance of RSBUndoManager:\n```objc\nself.undoManager = [[RSBUndoManager alloc] init]\n```\n\nRegister an undo action before change you want to be able to undo:\n```objc\n- (id)init {\n  // ...\n  someObject.someKeyPath = @\"oldValue\"\n  // ...\n}\n\n- (void)onAction {\n    [self.undoManager appendTarget:someObject keyPath:@\"someKeyPath\"];\n    someObject.someKeyPath = @\"newValue\"    \n}\n```\n\nPerform undo:\n```objc\n[self.undoManager undo];\n// someObject.someKeyPath will be set to @\"oldValue\"\n```\n\nYou won’t need to explicitly register redo action, so if you want to perform a redo just call:\n```objc\n[self.undoManager redo];\n// someObject.someKeyPath will be set to @\"newValue\"\n```\n\n## Memory Management\n\nRSBUndoManager provides 3 memory warning handling policies, which can be selected by setting `memoryWarningPolicy` property.\n\n`RSBUndoManagerMemoryWarningPolicyNone` (default) means that it will ignore memory warnings and always keep references to values in undo stack. Use it if you want to handle memory yourself.\n\n`RSBUndoManagerMemoryWarningPolicyDropHalf` means RSBUndoManager will try to drop half of actions in undo stack. It's not precise though, since it's not always possible to reliably determine amount of actions in stack due to limitations of NSUndoManager.\n\n`RSBUndoManagerMemoryWarningPolicyDropAll` means RSBUndoManager will drop all undo stack on memory warning. Use it if contents of undo stack are not that critical.\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Installation\n\nRSBUndoManager is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"RSBUndoManager\"\n```\n\nTo install it via [Carthage](https://github.com/Carthage/Carthage), simply add the following line to your Cartfile:\n\n```\ngithub \"rosberry/RSBUndoManager\"\n```\n\n## Authors\n\nAnton Kormakov, anton.kormakov@rosberry.com\n\n## About\n\n\u003cimg src=\"https://github.com/rosberry/Foundation/blob/master/Assets/logo.png?raw=true\" width=\"100\" /\u003e\n\nThis project is owned and maintained by Rosberry. We build mobile apps for users worldwide 🌏.\n\nCheck out our [open source projects](https://github.com/rosberry), read [our blog](https://medium.com/@Rosberry) or give us a high-five on 🐦 [@rosberryapps](http://twitter.com/RosberryApps).\n\n## License\n\nRSBUndoManager is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosberry%2Frsbundomanager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frosberry%2Frsbundomanager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosberry%2Frsbundomanager/lists"}