Created
October 23, 2021 17:59
-
-
Save rslifka/6f923fe332ed4f8706d1e449cee4fd93 to your computer and use it in GitHub Desktop.
Cannot declare conformance to 'NSObjectProtocol' in Swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import AuthenticationServices | |
| class Awesome: ASWebAuthenticationPresentationContextProviding { | |
| // ERROR: Cannot declare conformance to 'NSObjectProtocol' in Swift | |
| ... | |
| } | |
| import Foundation | |
| import AuthenticationServices | |
| class Awesome: NSObject, ASWebAuthenticationPresentationContextProviding { | |
| ... | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Initially found here while searching for the error message.
Presumably this is because
ASWebAuthenticationPresentationContextProviding(Apple Swift Docs) inherits fromNSObject? I'm not familiar with Objective-C, perhaps everything inherits fromNSObjectthe way everything inherits fromjava.lang.Objectin Java?My understanding is that by extending
NSObjectwe implement everything theNSObject-extended protocol requires, thus allowing us to satisfy the requirements forASWebAuthenticationPresentationContextProvidingimplementation.