Skip to content
forked from zixun/AppSwizzle

lightweight and flexible method swizzling wrapped by swift.

License

Notifications You must be signed in to change notification settings

Bogon/AppSwizzle

 
 

Repository files navigation

AppSwizzle

Swift 4.0+ Platform MIT

Context

This library is derived from the GodEye project which can automaticly disply Log,Crash,Network,ANR,Leak,CPU,RAM,FPS,NetFlow,Folder and etc with one line of code. Just like god opened his eyes

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

CocoaPods

AppSwizzle is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'AppSwizzle'

Carthage

Or, if you’re using Carthage, add SwViewCapture to your Cartfile:

github "Bogon/AppSwizzle"

Usage

Swizzle Instance Method

let orig = #selector(AppSwizzleTests.origSelector_testSwizzleInstanceMethod)
let alter = #selector(AppSwizzleTests.alterSelector_testSwizzleInstanceMethod)
AppSwizzleTests.swizzleInstanceMethod(origSelector: orig, toAlterSelector: alter)

Swizzle Class Method

let orig = #selector(AppSwizzleTests.origSelector_testSwizzleClassMethod)
let alter = #selector(AppSwizzleTests.alterSelector_testSwizzleClassMethod)
AppSwizzleTests.swizzleClassMethod(origSelector: orig, toAlterSelector: alter)

Swizzle Instance Method To Alter Class

let orig = #selector(AppSwizzleTests.origSelector_testSwizzleInstanceMethodToAlterClass)
let alter = #selector(OtherClass.alterSelector_testSwizzleInstanceMethodToAlterClass)
AppSwizzleTests.swizzleInstanceMethod(origSelector: orig, toAlterSelector: alter, inAlterClass: OtherClass.classForCoder())

Swizzle Class Method To Alter Class

let orig = #selector(AppSwizzleTests.origSelector_testSwizzleClassMethodToAlterClass)
let alter = #selector(OtherClass.alterSelector_testSwizzleClassMethodToAlterClass)
AppSwizzleTests.swizzleClassMethod(origSelector: orig, toAlterSelector: alter, inAlterClass: OtherClass.classForCoder())

维护者

name: Bogon

email: zhanqgixcu@gmail.com

github: Bogon

Author

name: 陈奕龙

twitter: @zixun_

email: chenyl.exe@gmail.com

github: zixun

blog: 子循(SubCycle)

License

AppSwizzle is available under the MIT license. See the LICENSE file for more info.

About

lightweight and flexible method swizzling wrapped by swift.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 74.1%
  • Ruby 15.8%
  • Objective-C 5.4%
  • Shell 4.7%