面向方面的Objective-C 库?
是否有任何面向方面的 Objective-C 库可以用于 iPhone 开发?
Is there any Aspect-Oriented Objective-C library that I could perhaps use for iPhone development?
有一个老项目叫 AspectCocoa,这可能就是您要搜索的内容.
There is an old project called AspectCocoa, this might be what you are searching for.
否则 Í 会建议您自己滚动.通过子类化 NSProxy
进行更改,或者基于代理的 AOP.或者,您可以使用非常酷的 Obj-C 运行时函数 method_exchangeImplementations()
.
Otherwise Í would suggest rolling your own. Either proxy based AOP by subclassing NSProxy
for a change. Or you could do some method swizzling with the quite cool Obj-C run-time function method_exchangeImplementations()
.
但是除非您正在寻找一个有趣的练习,否则请问问自己您想要实现什么,以及是否有一种现有的完美的 Objective-C 方法可以做到这一点.
But unless you are looking for a fun exercise, ask yourself what you want to achieve, and if there is an existing perfectly working Objective-C way to do it.