I can’t decide which would be the better implementation of a class managing user auth sessions and profile data from server. In this case, I feel a Singleton may be appropriate, but everything I’ve read advises against it.
In SwiftUI, I’m usually inclined to prefer the Apple approved method, but using an @EnvironmentObject makes user session data inaccessible to code outside of views—viewmodels, services… Is there a way to use @EnvironmentObject and make authentication service data accessible in non-view code? Would Singleton be an appropriate pattern for this case, or is there something else I’m missing?