Giter Site home page Giter Site logo

jrswizzle's Introduction

I see people have forked this so I figured I should add some information.

The only changes I've made to my knowledge were small ones to make it work on an iOS device. Use at your own risk! Below was the original README.

JRSwizzle

Description

JRSwizzle is source code package that offers a single, easy, correct+consistent interface for exchanging Objective-C method implementations ("method swizzling") across many versions of Mac OS X, Objective-C and runtime architectures.

More succinctly: JRSwizzle wants to be your one-stop-shop for all your method swizzling needs.

Download

$ cd /path/to/top/of/your/project
$ git submodule add git://github.com/rentzsch/jrswizzle.git JRSwizzle
$ git submodule init && git submodule update

# OPTIONAL: Execute the following commands if you want to explicitly peg
# to a certain version. Otherwise `git submodule update` will keep you
# current with HEAD.

$ cd JRSwizzle
$ git checkout v1.0d1

Reasons for Existence

  • Easy: Just do this: [SomeClass jr_swizzle:@selector(foo) withMethod:@selector(my_foo) error:&error]; Voila.
  • Correct: There's a subtle interaction between method swizzling and method inheritance. Following in Kevin Ballard's footsteps, this package Does The Right Thing.
  • Compatible: JRSwizzle should Just Work on any version of Mac OS X you care about. Here's the exhaustive compatibility list:
    • Mac OS X v10.3/ppc (Ballard implementation)
    • Mac OS X v10.4/ppc (Ballard implementation)
    • Mac OS X v10.4/i386 (Ballard implementation)
    • Mac OS X v10.5/ppc (method_exchangeImplementations+Ballard implementation)
    • Mac OS X v10.5/i386 (method_exchangeImplementations+Ballard implementation)
    • Mac OS X v10.5/ppc64 (method_exchangeImplementations+Ballard implementation)
    • Mac OS X v10.5/x86_64 (method_exchangeImplementations+Ballard implementation)
  • Robust: All parameters are checked and JRSwizzle returns an optional NSError with high-quality diagnostics.

Support

Please use JRSwizzle's Lighthouse project site to file bugs or feature requests.

To contribute, please fork this project, make+commit your changes and then send me a pull request.

Comparison

There's at least four swizzling implementations floating around. Here's a comparison chart to help you make sense of how they relate to each other and why JRSwizzle exists.

Scenario Swizzle Technology Method Implementation Correct Behavior 10.4 64-bit
1 Classic Direct YES YES NO
2 Classic Inherited NO YES NO
3 Ballard Direct YES YES NO
4 Ballard Inherited YES YES NO
5 Apple Direct YES NO YES
6 Apple Inherited NO NO YES
7 JRSwizzle Direct YES YES YES
8 JRSwizzle Inherited YES YES YES

License

The source code is distributed under the nonviral MIT License. It's the simplest most permissive license available.

Version History

  • v1.0d1: May 31 2009

    • [FIX] Soothe valgrind by nulling out hoisted_method_list->obsolete, which it apparently reads. (Daniel Jalkut)

    • [FIX] Xcode 3.2 apparently now needs ARCHS set explicitly for 10.3 targets. (rentzsch)

  • v1.0d0: Apr 09 2009

    • Moved to github.
  • v1.0d0: Dec 28 2007

    • Under development.

jrswizzle's People

Contributors

rentzsch avatar outis avatar djdrzzy avatar jensayton avatar

Stargazers

 avatar Ilias Karim avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.