Code Block protocol AccessTokenProvider: Authenticator { func accessToken() -> AccessTokenPublisher }
where Authenticator is
Code Block public class Authenticator: NSObject, ObservableObject
However, when I add this to the environment as
Code Block var authenticator: AccessTokenProvider = MyAuthenticator() […] ContentView().environmentObject(authenticator)
the compiler throws an error at:
Code Block struct ContentView: View { // error: property type 'AccessTokenProvider' does not match that of the 'wrappedValue' property of its wrapper type 'EnvironmentObject' @EnvironmentObject var authenticator: AccessTokenProvider ^
Is this even a good idea? If so, what am I doing wrong?
^