Method Swizzling Fun Fact

WWDC-2018

Hello

Eventually, I have had my answer about using method swizzling in Swift/Objective-C/

One of my teammates in AT&T who went to WWDC 2018 with a list of the desired questions to ask Apple engineers, he took notes some answers. These are 2 questions on Swizzling which were brought up

1. Do you allow an app to use Swizzling techniques? 

That would be a policy rather than a technical thing. It’s fine as long as it’s not being used to call private APIs or is causing a crash. Swizzling by itself is okay, it just depends what you do with it. What you can do on the technical side and the rules that govern the App Store side are not necessarily in sync.

2. How do you use Swizzling properly?

(Refer to Swizzling and Direct Override sections)

You can clean it up a little bit using imp_implementationWithBlock instead also. But that may be unnecessary.

Note: Clean memory contains memory mapped files such as read-only images and frameworks that are paged out. Any full pages are purgeable by the system. But if you do any runtime swizzling that can actually make clean memory dirty.

Dirty memory is any memory that has been written to by your app. It cannot be automatically deallocated due to the lack of a paging system in iOS. iOS has no swap mechanism, so dirty memory will be kept in physical memory until it reaches a certain limit, then your App will be terminated.

I actually did hand over more than 2 questions about this category. Although not having a full list of questions answered, these two have revealed almost my concerns about using or not using method swizzling technique.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s