peterfriese / MakeItSo

This is the source code for Make It So, the sample app accompanying my blog post "Replicating the iOS Reminders App Using SwiftUI and Firebase"

Home Page:https://twitter.com/peterfriese/status/1453467058302291975

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

signInWithAppleButtonTapped - make the default method 'signIn' ?

antiero opened this issue · comments

Testing in Xcode 12.4, iOS 14.4, following this tutorial (awesome stuff by the way!)

In SignInView.swift, when calling signInWithAppleButtonTapped, I noticed the .link option is use for the signInHandler state...

In AuthenticationService.swift, inside caseAuth.auth().currentUser was always returned nil for me (presumably because it's always logged in as an anonymous user before?)

I changed signInWithAppleButtonTapped to be .signIn, and the App logs in ok:

  func signInWithAppleButtonTapped() {
    signInHandler = SignInWithAppleCoordinator(window: self.window)
    signInHandler?.signIn { (user) in
      print("User signed in. UID: \(user.uid), email: \(user.email ?? "(empty)")")
      self.presentationMode.wrappedValue.dismiss()
    }
  }

So I wonder whether for the example code it makes sense to have .signIn as the state option, and a separate button flow for linking accounts?