The above code checks to make sure an email address is valid, this part works correctly. I can also retrieve the values correctly from the completion handler.
DispatchQueue.global(qos: .utility).async {
let json = Json()
//check is email address exists using completion handler
json.isEmailAddressValid(input:email!) { (result: Bool) in
print("Result", result)
DispatchQueue.main.async {
if (!(result)) {
print("Email not found")
message?.append("\nEmail Address does not exisit")
}
}
}
self.alert(message:message!)
I want to use the result variable when an email address is not found, then append Email Address not found message onto the concatenated string. I have tried many times, but the error message never gets shown within the alert view when using DispatchQueue
. Am I using an incorrect thread?