jrswizzle

one-stop-shop for all your method swizzling needs

  • 所有者: rentzsch/jrswizzle
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

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, iOS, 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 semver-1.x
$ 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.1.0

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 and iOS 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)
    • iOS 2.0+ (method_exchangeImplementations+Ballard implementation)
  • Robust: All parameters are checked and JRSwizzle returns an optional NSError with high-quality diagnostics.

Support

Please use JRSwizzle's GitHub Issues tab 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.

License

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

Version History

  • v1.1.0: Nov 28 2016

    • [NEW] Block-based swizzle api. Note it uses NSInvocation which is known to be not the fastest of APIs. (dhcdht)
  • v1.0: Mar 2 2012

  • 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.

主要指标

概览
名称与所有者rentzsch/jrswizzle
主编程语言Objective-C
编程语言Objective-C (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2009-04-10 02:44:13
推送于2023-01-20 13:52:28
最后一次提交
发布数4
最新版本名称v1.1.0 (发布于 2016-11-28 14:30:54)
第一版名称v1.0d0 (发布于 2009-04-09 23:36:57)
用户参与
星数2.7k
关注者数81
派生数416
提交数31
已启用问题?
问题数15
打开的问题数9
拉请求数7
打开的拉请求数3
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?