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 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 { | |
... | |
} |
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 fromNSObject
the way everything inherits fromjava.lang.Object
in Java?My understanding is that by extending
NSObject
we implement everything theNSObject
-extended protocol requires, thus allowing us to satisfy the requirements forASWebAuthenticationPresentationContextProviding
implementation.