113 questions
0 votes
0 answers
59 views
Method Swizzling Not Calling Original touchesBegan and touchesEnded Methods in Swift
I am trying to implement method swizzling in Swift to intercept touchesBegan and touchesEnded methods across all UIResponder instances. However, I'm encountering issues where the original methods ...
0 votes
1 answer
142 views
Swift + Objective C swizzling class_getInstanceMethod is returning nil
I am using AsyndDisplayKit/Texture where: https://github.com/TextureGroup/Texture/blob/923901a1cebf0b6c51627aca2a6748dee84af143/Source/ASTextNode.mm#L934 ASTextNode has this function: + (CGColorRef)...
1 vote
1 answer
154 views
issue while intercepting and replacing syscall in C
I'm trying to intercept all "syscall"s for my code. I'm able to receive the calls, but for some reason my implementation of syscall is not equivalent, because at some point the program ...
0 votes
1 answer
128 views
Method Swizzling and Inheritance
As I know, method swizzling with method_exchangeImplementations(A, B) function exchanges A method and B method in runtime. If I get method with: let A = class_getInstanceMethod(UIViewController.self, #...
1 vote
2 answers
78 views
Assigning to a pointer causes EXC_BAD_ACCESS through class_addMethod
I have an internal class that adoptsUIScrollViewDelegate, but does not implement scrollViewWillEndDragging(_:withVelocity:targetContentOffset:). I want to add this method to the class using ...
0 votes
0 answers
40 views
Getting error while implementing method swizzling in Swift [duplicate]
I have gone through so many article and have a good idea how we should implement method swizzling. But I'm getting this error while writing the original #selector for UserDefault class. extension ...
3 votes
2 answers
322 views
Objective-C: Methods called by a swizzled method should call the original implementation
I'm fixing bugs in someone else's closed-source app. In macOS, scrollbars can be set in System Preferences to display "always" (NSScrollerStyleLegacy), "when scrolling" (...
0 votes
1 answer
158 views
UIColor initWithCoder extract color name
I'm experimenting with adding a form of theming support to iOS by swizzling UIColor constructor methods. I'm having trouble with a scenario coming from a storyboard when a control uses a "named ...
0 votes
1 answer
374 views
Swift swizzling init function
I'm trying to capture initialisation of InputStream with file URL in Swift. I've successfully implemented such capture in Objective-C for NSInputStream class. The issue is that after exchanging ...
4 votes
1 answer
2k views
Swift - Method swizzling for private framework's method and then invoking original implementation
I'm trying to swizzle a private framework's method to perform some custom logic and then would like to call the original implementation. Code: class SwizzlingHelper { private struct Constants { ...
0 votes
1 answer
814 views
Swizzling, Simulator, and Remote Push Notifications - iOS 14
I'm getting strange behavior in iOS 14 with regards to remote notifications on iOS and Firebase Cloud Messaging (FCM). DEVICE First, I cannot send Test notifications to my device from the FCM console. ...
0 votes
1 answer
123 views
Is it possible to Swizzle NSAttributedString.init(string:attributes)?
I am trying to swizzle NSAttributedString but getting a compile error: extension NSAttribtuedString { @objc convenience init(swizzledString: String, attributes: [NSAttributedString.Key : Any?] { ...
2 votes
1 answer
884 views
Tracking All Events of ViewController and UIControls for Custom Analytics Framework iOS
I am working on an analytics SDK which will track all the user events which view is appeared or disappeared, Which button is clicked, Which UISwitch is turned ON or OFF, UITableView is scrolled or ...
2 votes
1 answer
742 views
Swizzling UIImage init not working iOS Swift
I am trying to swizzle UIImage.init(named:) but the init is not being called extension UIImage { @objc public convenience init?(swizzledName: String) { self.init(named: swizzledName) ...
2 votes
1 answer
259 views
Swizzling UIImage.init(named:) returns nil when getting the instance method
I am trying to swizzle UIImage init functions but when trying to get the instance function they return nil. Any idea? let instance = class_getInstanceMethod(self, #selector(UIImage.init(named)) let ...