Method swizzling in swift 4 [duplicate]
This question already has answers here : Swift 3.1 deprecates initialize(). How can I achieve the same thing? (9 answers) Swizzling in Swift 4 no longer works. Method 'initialize()' defines Objective-C class method 'initialize', which is not permitted by Swift This is something I have found a solution to so wanted to leave the questions and answer for others. initialize() is no longer exposed: Method 'initialize()' defines Objective-C class method 'initialize', which is not permitted by Swift So the way to do it now is to run your swizzle code via a public static method. e.g In the extension: