3 ms·
Swizzling uses the Objective-C runtime, which in turns handles the message passing mechanism. Unless you inherit from an NSObject, you can’t swizzle in Swift.
by monocularvision 6y ago
Swizzling uses the Objective-C runtime, which in turns handles the message passing mechanism. Unless you inherit from an NSObject, you can’t swizzle in Swift.
- favorited 6y agoUnless you're building something on your own, in which case there is an (unoffically supported) attribute which you can use to opt-in to swizzling of methods. The difference being you have to opt-in, so you can't swizzle someone else's methods (unless they let you). https://twitter.com/jckarter/status/1135730593537249282?lang=en https://twitter.com/jckarter/status/1135730593537249282?lang...
- andrekandre 6y agoand even then, youll have to mark your properties and functions @objc / dynamic to allow that to work with messaging