{"id":28619634,"url":"https://github.com/eleme/nvmaspects","last_synced_at":"2025-06-12T04:40:53.358Z","repository":{"id":56921068,"uuid":"88482308","full_name":"eleme/NVMAspects","owner":"eleme","description":null,"archived":false,"fork":false,"pushed_at":"2018-02-05T11:02:05.000Z","size":550,"stargazers_count":15,"open_issues_count":4,"forks_count":1,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-05-30T03:48:11.236Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","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/eleme.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-04-17T07:15:27.000Z","updated_at":"2021-01-09T05:48:14.000Z","dependencies_parsed_at":"2022-08-21T04:50:39.093Z","dependency_job_id":null,"html_url":"https://github.com/eleme/NVMAspects","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/eleme/NVMAspects","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eleme%2FNVMAspects","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eleme%2FNVMAspects/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eleme%2FNVMAspects/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eleme%2FNVMAspects/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eleme","download_url":"https://codeload.github.com/eleme/NVMAspects/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eleme%2FNVMAspects/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259400459,"owners_count":22851816,"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":[],"created_at":"2025-06-12T04:40:50.619Z","updated_at":"2025-06-12T04:40:53.343Z","avatar_url":"https://github.com/eleme.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NVMAspects\n\n## About\nYet another AOP library for Objective-C, but implement by using [libffi](https://github.com/libffi/libffi/). The main goal for this lib is to avoid heavily use of `forwardInvocation`, powerful, easy to use and also easy to read.\n\nThis lib is inspired by [Aspects](https://github.com/steipete/Aspects), [JSPatch](https://github.com/bang590/JSPatch), [NSBlog](https://www.mikeash.com/pyblog/) and [sunnyxx's blog](http://blog.sunnyxx.com/archives/), thanks all these people.\n\n## Example\n\nA simple example is look like this, provide a block to replace the original implementation, look very similar to [Aspects](https://github.com/steipete/Aspects) but have a bit difference. You can alter the arguments or return value by modify `info.invocation`. If you aren't sure the existing of original implementation, you should call `class_addPlaceholderIfNoImplement` fisrt.\n\n```objective-c\n[[UIImage nvm_hookInstanceMethod:@selector(imageNamed:)\n                      usingBlock:^void(NVMAspectInfo *info, NSString *name) {\n                        NSLog(@\"Load image named %@\", name);\n                        [info.invocation invoke];\n                      }];\n```\n\n## Notes\n\n- Actually there are some bugs on this lib, [Bit Field](https://github.com/eleme/NVMAspects/issues/3),  [Union](https://github.com/eleme/NVMAspects/issues/2), [Struct contain array](https://github.com/eleme/NVMAspects/issues/1). But `bit field` and `union` are also not well supportted by apple's `NSInvocation`, struct contain small array is a bug in `libffi`.  All these features used very rare in Objective-C,  so it's not a big problem.\n\n- NVMAspects doesn't forbidden you to hook any method, but if you make some changes to method like `alloc`, you should follow the memory management policy, especially in `ARC`.\n\n- Currently if a class has defined a method, hook this method will change it's `imp`, even if that method is implemented by it's super class. But this is not a big problem, you can distinguish the class by test `[self class]` in you block. If the class has not defined a method, you should call `class_addPlaceholderIfNoImplement` first.\n\n- For problem caused by `forwardInvocation`, you can use this keyword to search issues in `Aspects` or `JSPatch`.\n\n## Installation\n\nadd the following line to your Podfile:\n\n```ruby\npod \"NVMAspects\"\n```\n\n## License\n\nNVMAspects is released under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feleme%2Fnvmaspects","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feleme%2Fnvmaspects","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feleme%2Fnvmaspects/lists"}