Good approach. But it would require the parent view body to specify the type parameter for Provider, something like YourView<ConcreteAccessTokenProvider>().
Two issues: (1) Having to explicitly specify the type parameter defeats one of the purposes of using environmentObject in the first place, which is reducing explicit specification of property fields and types in each view. (2) Explicitly specifying the type parameter is acceptable in the topmost view, but how is an inner view know what concrete implementation was used when the object was instantiated in the .environmentObject() call?
I think SwiftUI needs a better solution to this.
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: