Post

Replies

Boosts

Views

Activity

Reply to @EnvironmentObject and Protocols?
You can just use some generics: public protocol Authenticator: ObservableObject {} public protocol AccessTokenProvider: Authenticator {} struct YourView<Provider>: View where Provider: AccessTokenProvider {     @EnvironmentObject var authenticator: Provider     var body: some View {         EmptyView()     } }
Apr ’22