Post

Replies

Boosts

Views

Created

Apple Sign In Button does not work properly
So guys I have this apple sign in button but I have two major problems. 1 - After I click on sign in and enter the pass, the animation stuck at the scroll and make me wait forever which does not result in a successful login. 2 - Cant have the only Apple icon on it. SignInWithAppleButton(                 .signIn,                 onRequest: { request in                     // 1                     request.requestedScopes = [.fullName, .email]                 },                                  onCompletion: { result in                     switch result {                     case .success (let authResults):                         // 2                         print("Authorization successful.")                     case .failure (let error):                         // 3                         print("Authorization failed: " + error.localizedDescription)                     }                 }                          ).signInWithAppleButtonStyle(colorScheme == .dark ? .white : .black).frame(width: UIScreen.main.bounds.width * 0.18, height: UIScreen.main.bounds.height * 0.08).cornerRadius(16)
5
0
1.3k
Jan ’22
Apple Sign In is stuck
So I made this Apple sign-in button and it gives a response that's not the problem actually. The main problem appears when you choose your mail to sign in and it gets stuck in there. import AuthenticationServices struct SignInApple: View {          @State var isActive = false     @Environment(\.colorScheme) var colorScheme          @AppStorage("email") var email: String = ""     @AppStorage("firstName") var firstName: String = ""     @AppStorage("lastName") var lastName: String = ""     @AppStorage("userId") var userId: String = ""     @State var isActive2 = false          var body: some View {                  NavigationView{         NavigationLink(destination: HomeView().navigationBarBackButtonHidden(true).navigationBarHidden(true), isActive: $isActive){                 SignInWithAppleButton(.continue) {request in                                          request.requestedScopes = [.email, .fullName]                                      } onCompletion: { result in                                          switch result {                                              case .success(let auth):                                                  switch auth.credential {                         case let credential as ASAuthorizationAppleIDCredential:                                                                                                                                                                       let email = credential.email                             let firstName = credential.fullName?.givenName                             let lastName = credential.fullName?.familyName                             let userId = credential.user                                                          self.email = email ?? ""                             self.userId = userId ?? ""                             self.firstName = firstName ?? ""                             self.lastName = lastName ?? ""                                                                                                              default:                             break                         }                                              case .failure(let error):                         print(error.localizedDescription)                     }                                      }.signInWithAppleButtonStyle(colorScheme == .dark ? .white : .black).cornerRadius(16).frame(width: 30, height: 130)                                 }         }                                   }     } struct TestArea_Previews: PreviewProvider {     static var previews: some View {         SignInApple()     } }
0
0
352
Jan ’22
How to have the square (logo only) Apple sign in button.
I've been working for 3 - 5 days on this but still, I couldn't find a clear working way to have the Apple sign-in button. By the way, the button will be functioning in this code. Button(action: {                         print("Apple Sign In been tapped")                                              }) {                         ZStack {                             RoundedRectangle(cornerRadius: 16)                                 .fill(Color(#colorLiteral(red: 0.9725490212440491, green: 0.9725490212440491, blue: 0.9725490212440491, alpha: 1)))                                 .frame(width: UIScreen.main.bounds.width * 0.2, height: UIScreen.main.bounds.height * 0.08)                             Image("apple").resizable().frame(width: UIScreen.main.bounds.width * 0.1, height: UIScreen.main.bounds.height * 0.046, alignment: .center)                                                      }                     }
2
0
555
Jan ’22