Hello I have a problem with xCode, I have this error : Cannot find « string » in scope. Thank you so much for your help
Photos:
My code:
//
// AuthviewModel.swift
// iSpeak
//
// Created by Sayan on 21.11.22.
//
import Foundation
import Firebase
class AuthViewModel: ObservableObject {
var manager = FirebaseManager.shared
@Published var isFinishedConnecting: Bool = false
@Published var isAuth: Bool = false
@Published var showError: Bool = false
var errorString: String = ""
var datas: [String: Any] = [:]
var auth: Auth {
return manager.auth
}
init() {
observeAuthentication()
}
func observeAuthentication() {
auth.addStateDidChangeListener(handleChangeListener)
}
func handleChangeListener(auth: Auth, user: User?) {
self.isFinishedConnecting = true
self.isAuth = user != nil
}
func signIn(email: String, password: String) {
guard checkValue(_string: email, value: "adresse email") else { return }
guard checkValue(_string: password, value: "Mot de passe") else { return }
}
func createUser() {
}
func checkValue(_string: String, value: String) -> Bool {
let isNotEmpty = string != ""
self.errorString = !isNotEmpty ? "" : "Merci d'entrer (value) pour continuer"
self.showError = !isNotEmpty
return isNotEmpty
}
}