Method swizzling in iOS swift
What is method swizzling ?? — this was a question asked in an interview. I didn’t knew the answer back then. I googled it and found many articles about method swizzling. But, I couldn’t understand the proper use case of method swizzling. Michael Mavris’s article on method swizzling was simple and easy to understand. Read it here.
4 min readDec 21, 2017
Today, I was integrating FCM in my iOS app. I saw the same word method swizzling again in the firebase documentation. It said:
So, its an important thing to know. Let’s understand what it is.
What is method swizzling?
Method swizzling is the process of changing the implementation of an existing selector at runtime. Simply speaking, we can change the functionality of a method at runtime.
Note: This is an Objective-C runtime feature.
For example: If you want to track the keys and values added to the UserDefaults
and add a prefix string before…