0

Is it ok to check

Amplify.Auth.getCurrentUser() != nil

or should the app maintain a state variable and set that from this listener?

   _ = Amplify.Hub.listen(to: .auth) { payload in
        switch payload.eventName {
        case HubPayload.EventName.Auth.signedIn:
            // Update UI
            ....

If it's the latter, is that suppose to work even if the user logged in during one of the previous sessions?

rysv
  • 2,416
  • 7
  • 30
  • 48

1 Answers1

2

After further research and from Discord discussions looks like this is the best approach:

Amplify.Auth.getCurrentUser() != nil
rysv
  • 2,416
  • 7
  • 30
  • 48