Redefine makes easier to overwrite methods implementations during runtime using the objc runtime. It also makes possible to switch back and forth through implementations, the original and the new one. It uses the C++ concept of RAII, so the user just have to make sure to maintain a reference to the redefinition object for it to take place. When it is deallocated, everything goes back to normal.

The obvious use for it is unit tests. You don't have to prepare your code specifically for tests using factories, interfaces and etc, since it's possible to redefine any class or instance method. But, of course, you can do a lot of other crazy stuffs if you want to =D

Redefine on GitHub

  1. журнал детский психолог says:

    I do not know іf it’s ϳust mе or if everyone else experiencing pгoblems wіtһ
    youг website. It appears ⅼike ѕome оf thе written text
    on your posts arе running off tһe screen. Can somebody else pⅼease provide feedback ɑnd let me know if this is happening t᧐ them too?
    Thiѕ mіght ƅe a issue wіth my browser ƅecause I’ve һad this hɑppen previoᥙsly.
    Ⅿany thanks

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>