Swift & the Objective-C Runtime
Unfortunately, a
load
class method implemented in Swift is never called by the runtime, rendering that recommendation an impossibility. Instead, we’re left to pick among second-choice options:
Implement method swizzling in
initialize
This can be done safely, so long as you check the type at execution time and wrap the swizzling indispatch_once
(which you should be doing anyway).Implement method swizzling in the app delegate