Skip to content

Instantly share code, notes, and snippets.

@navsing
Created May 14, 2020 22:02
Show Gist options
  • Select an option

  • Save navsing/bf2fd7fa3b9279b0ef37c3acd2a458e0 to your computer and use it in GitHub Desktop.

Select an option

Save navsing/bf2fd7fa3b9279b0ef37c3acd2a458e0 to your computer and use it in GitHub Desktop.
final class AppleViewModel: ObservableObject {
var signInWithApple = SignInWithAppleCoordinator()
@Published var user: User?
func getRequest() {
signInWithApple.getApppleRequest()
}
func getUserInfo() {
if let userData = UserDefaults.standard.object(forKey: "user") as? Data,
let userDecoded = try? JSONDecoder().decode(User.self, from: userData) {
print("UserData: \(userDecoded)")
user = userDecoded
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment