MarioIannotta / Swizzleswift
Licence: mit
Swizzle selectors with just one clean and elegant API
Stars: ✭ 140
Programming Languages
swift
15916 projects
Labels
Projects that are alternatives of or similar to Swizzleswift
Swifthook
A library to hook methods in Swift and Objective-C.
Stars: ✭ 93 (-33.57%)
Mutual labels: runtime
Arcgis Appstudio Samples
Collection of samples available in AppStudio for ArcGIS desktop to learn and help build your next app.
Stars: ✭ 78 (-44.29%)
Mutual labels: runtime
Next Runtime Dotenv
Expose environment variables to the runtime config of Next.js
Stars: ✭ 136 (-2.86%)
Mutual labels: runtime
Webworkify Webpack
launch a web worker at runtime that can require() in the browser with webpack
Stars: ✭ 105 (-25%)
Mutual labels: runtime
Dotnetbook
.NET Platform Architecture book (English, Chinese, Russian)
Stars: ✭ 1,763 (+1159.29%)
Mutual labels: runtime
Charm
The Charm++ parallel programming system. Visit https://charmplusplus.org/ for more information.
Stars: ✭ 96 (-31.43%)
Mutual labels: runtime
Icmethoddigger
An easy way to print almost methods including private methods (supported arm64 architecture devices).
Stars: ✭ 103 (-26.43%)
Mutual labels: runtime
Mulle Objc Runtime
⏩ A fast, portable Objective-C runtime written 100% in C11
Stars: ✭ 90 (-35.71%)
Mutual labels: runtime
Client
An alternative Polkadot Runtime Environment implementation acting as a full-node (excluding block production for validators) for syncing with Substrate-based chains.
Stars: ✭ 82 (-41.43%)
Mutual labels: runtime
Apple Juice Actionscript
Pure .NET 2.0 code Implementation of the ActionScript3 compiler and runtime. Can be used to run scripts in environments where "just-in-time compilation" is not possible
Stars: ✭ 112 (-20%)
Mutual labels: runtime
Lunatic
Lunatic is an Erlang-inspired runtime for WebAssembly
Stars: ✭ 2,074 (+1381.43%)
Mutual labels: runtime
SwizzleSwift
Who said that method swizzling needs to look ugly? SwizzleSwift is a little wrapper that lets you swizzle selectors just one clean and elegant API.
Installation
Pods
pod 'SwizzleSwift'
Swift package manager
From Xcode, select File → Swift Packages → Add Package Dependency → Select your project → Search SwizzleSwift
Usage example
Swizzle(<#AType.Self#>) {
<#OriginalSelector#> <-> <#SwizzledSelector#>
}
Given the following controller
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
print(#function)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
print(#function)
}
}
extension UIViewController {
@objc private func myViewDidLoad() {
print(#function)
myViewDidLoad()
}
@objc private func myViewWillAppear(_ animated: Bool) {
print(#function)
myViewWillAppear(animated)
}
}
Swizzling the methods like this
extension UIViewController {
@objc static func methodSwizzling() -> Void {
Swizzle(ViewController.self) {
#selector(viewDidLoad) <-> #selector(myViewDidLoad)
#selector(viewWillAppear(_:)) <-> #selector(myViewWillAppear(_:))
}
}
}
Will produce the following output
myViewDidLoad()
viewDidLoad()
myViewWillAppear(_:)
viewWillAppear(_:)
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].