swiftuifirebase-authenticationsign-in-with-apple

Why isn't sign in with apple button working?


When I drag out the SignInWithAppleButton control using swiftui, this is the code that is shown. However, I get the error message "Argument passed to call that takes no arguments". The compiler only allows the project to build when SignInWithAppleButton() is used.

I've found lots of code online that uses the below format. Why isn't it working now? What is the correct alternative if onRequest and onCompletion can't be used?

            SignInWithAppleButton(
            onRequest: { request in
                
            },
            onCompletion: { result in
                
            }
        )

Solution

  • works for me on macos 12.beta using xcode 13.beta, target ios 14.5 and macCatalyst 11.3. What system are you using?

    import SwiftUI
    import AuthenticationServices
    
    @main
    struct TestApp: App {
        var body: some Scene {
            WindowGroup {
                ContentView()
            }
        }
    }
    struct ContentView: View {
        var body: some View {
            SignInWithAppleButton(onRequest: { request in
                 print("onRequest")
             },
             onCompletion: { result in
                print("onCompletion")
             }
            ).frame(width: 222, height: 66)
        }
    }