'issue adding sign in with apple to an iOS project that uses objc and swift code

I am trying to implement sign in with apple using their AuthenticationServices framework into my app which has both objc and swift code.

I have followed various tutorials to make sure I have included everything needed. I want to have this feature written in swift but when I am trying to build the app on the xcode simulator I am getting a few errors when the project-Swift.h file is being generated. Xcode complains that it cannot find protocol declarations for: ASAuthorizationControllerPresentationContextProviding and ASAuthorizationControllerDelegate

Example of errors in project-Swift.h is here:

Looking around I have found several people who had issues with protocol declarations not being found in their project-Swift.h file but the solution was to import in a reference to the framework involved within their Project-Bridging-Header.h file. I did that as well in my Project-Bridging-Header.h file with this entry:

#import <AuthenticationServices/AuthenticationServices.h>

This unfortunately did not work. Does anyone have any insights or ideas that could help me out? I would like to implement this feature with swift code and not have to write it in objc.

Thanks



Solution 1:[1]

solution was pretty simple.

I needed to add the following import to the objc files that had references to my project-Swift.h file. This caused all the errors to resolve. The following import needed to go before the import for project-Swift.h.

#import <AuthenticationServices/AuthenticationServices.h>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Doug