0

Hello I'm trying to make a connection via facebook in the project I already use a LoginInteractor but when I want to use the class in another file it does not find it.

import Foundation
import FBSDKCoreKit
import FBSDKLoginKit

class LoginViewModel: ObservableObject {
    @Published var email = ""
    @Published var error = false
    @Published var validationButton = false
    @Published var showIng = false
    @Published var signup = false
    @Published var signIn = false
    
    private let loginInteractor = LoginInteractor()
    
    init() {
        ApplicationDelegate.shared.application(
            UIApplication.shared,
            didFinishLaunchingWithOptions: nil
        )
    }
    func loginWithFacebook(fromViewController sourceViewController: UIViewController) {
        // Appeler la méthode de LoginInteractor pour gérer la connexion Facebook
        loginInteractor.loginUser(fromViewController: sourceViewController) { result in
            switch result {
            case .success(let userData):
                // Utilisez les données de l'utilisateur (nom, email) comme nécessaire
                let name = userData["name"] as? String
                let email = userData["email"] as? String
                
            case .failure(let error):
                print("Erreur de connexion Facebook : \(error)")
            }
        }
    }
}
1
  • since publishing my post I have not found a solution
    – tech
    Sep 6 at 8:55

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.