Search code examples
iosswiftframeworksvoippushkit

Use Pushkit in swift class rather than AppDelegate


I am trying to create a swift framework which allows VOIP calling in iOS using Pushkit and callkit. Since, Framework does'nt have AppDelegate and according to apple docs pushkit can only be used in AppDelegate or file extensions. Therefore, I am facing a huge problem in using the Pushkit framework in a swift class as the PKPushRegistryDelegate protocol:-

func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType){}

does'nt get called when i use it in a swift class instead of AppDelegate. However in AppDelegate it works fine Please someone help me on this really quick as i have deadlines to meet.


Solution

  • I figured out the solution The best way is to create your Custom class as delegate in your framework and import this class in your applications AppDelegate in which you would like to add your framework. If anyone wants a more detailed answer, let me know in the comment section. I would be happy to help.