Skip to content

🌪 Lazy method swizzling, limited to 20 arguments.

License

Notifications You must be signed in to change notification settings

monkeyspot/stormborn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌪 stormborn

Lazy method swizzling, limited to 20 arguments.

Example

without arguments

UIView.swizzle🌪.layoutSubviews { (object, sup) -> in
    sup.invoke()
}

with arguments

UIViewController.swizzle🌪.viewDidAppear { (object, animated: Bool, sup) -> in
    sup.invoke(animated)
}

multiple arguments and return types

class Greeter: NSObject {
    @objc dynamic func greet(first: String, last: String) -> String {
        return "Hello \(first) \(last)"
    }
}

Greeter.swizzle🌪.greetWithFirstlast { (object, arguments: (first: NSString, last: NSString), sup) -> NSString in
    return sup.invoke(arguments.first, arguments.last)
}

Author

Oliver Letterer, [email protected]

License

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

About

🌪 Lazy method swizzling, limited to 20 arguments.

Resources

License

Stars

Watchers

Forks

Packages

No packages published