[ad_1]
I’ve this in the primary view:
@Atmosphere(.dismiss) var dismiss
func closeLogin(){
self.dismiss()
}
and I move this perform to a subview and there I attempt to name it from inside one other perform:
func tryLogin() async throws {
guard let url = URL(string: area + "/do_login.php") else { return }
var postString = "&electronic mail=" + String(inputEmail)
postString += "&password=" + String(password)
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.httpBody = postString.knowledge(utilizing: String.Encoding.utf8)
let (knowledge, _) = strive await URLSession.shared.knowledge(for: request)
if let json = strive JSONSerialization.jsonObject(with: knowledge, choices: []) as? [String: Any] {
if(json["passed"] as! Int == 1){
if let uid = json["userid"] as? Int {
userid = uid
}
closeLogin() // <<<<
}
}
}
I get
Thread 23: EXC_BREAKPOINT (code=1, subcode=0x1861b7e5c)
on
self.dismiss()
Please assist
[ad_2]
