Extend AppDelegate from Objective-C to Swift
Published in
2 min readSep 17, 2020
If your AppDelegate is written in Objective-C and you are looking to write an extension to support Swift, this article is for you..
Step One:
Create a new swift file — example, AppDelegateExtension.swift , and add the following code snippet.
Note: Don’t forget to include public access specifier, else methods inside extension cannot be accessed in Objective-C file.
Step Two:
In your AppDelegate.m, you can call extension methods. See the below code snippet
Step Three:
In your AppDelegate.m, add the following header.
import "Objective C generated Interface Header Name"
You can get this value from: Build Settings -> Swift Compiler General
That’s it folks.. hope you like this. :)