Skip to content

Instantly share code, notes, and snippets.

@Sakurina
Created May 9, 2010 19:04
Show Gist options
  • Save Sakurina/395342 to your computer and use it in GitHub Desktop.
Save Sakurina/395342 to your computer and use it in GitHub Desktop.
CaptainHook-inspired syntax sugar for hooking stuff with Cycript
/*
* fairchild - an enhanced syntax for hooking stuff with Cycript
* by Yanik Magnan - http://r-ch.net
*/
var FCSuper = {};
var FCClassSuper = {};
function FCMethod(_className, _selector, _block) {
if (!FCSuper[_className])
FCSuper[_className] = {};
var _class = objc_getClass(_className);
FCSuper[_className][_selector] = _class.messages[_selector];
_class.messages[_selector] = _block;
}
function FCClassMethod(_className, _selector, _block) {
if (!FCClassSuper[_className])
FCClassSuper[_className] = {};
var _class = objc_getClass(_className);
FCClassSuper[_className][_selector] = _class->isa.messages[_selector];
_class->isa.messages[_selector] = _block;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment