Publishing Cognito authentication state changes to environmentObject on background thread
问题 I am working on a SwiftUI app that utilizes AWS Amplify/Cognito for its authentication. I have created a session object that keeps track of whether a user is authenticated. This session object is an ObservableObject that is loaded into environmentObject and accessed by different views. It has a @Published property called isLoggedIn. Within this session object, a listener has been created to capture changes in authentication state which update the value of isLoggedIn. The code compiles and