Junior — Middle
What types of dispatching are not modifiable through the Swizzling method?
sobes.tech AI
Answer from AI
Swizzling in iOS allows changing method implementations at runtime, but it only works with Objective-C dynamic dispatch. Types of dispatch that cannot be modified through Swizzling:
- Static dispatch (e.g., C or C++ function calls without virtual methods).
- Swift dispatch using statically resolved methods (e.g., final methods or struct methods).
- Method calls that are not implemented via the Objective-C runtime (e.g., methods not marked with @objc).
Therefore, Swizzling is only applicable to methods that go through the Objective-C runtime and does not work with purely Swift methods without @objc.