I am trying to check if the connection for imapsession is established. If it is established then the user should move on the next ViewController but if the connection is failed then it shows an error.
I am new to MailCore and there is not much documentation and guides so I couldn't find any information on how to code it.
Though I tried something myself:
var imapsession:MCOIMAPSession = MCOIMAPSession()
var checkAccount:MCOIMAPOperation = MCOIMAPOperation()
@IBAction func button1(_ sender: Any) {
checklogin()
}
func checkLogin() {
imapsession.hostname = "hostname"// String
imapsession.username = usr // String
imapsession.password = psw // String
imapsession.port = port // UInt32 number
imapsession.authType = MCOAuthType.saslPlain
imapsession.connectionType = MCOConnectionType.TLS
checkAccount.start({ (error) in
if let error = error {
print("error connecting")
print(error)
} else {
self.performSegue(withIdentifier: "TabSegue", sender: self)
}
})
}
Any ideas on how to do it in a proper way?
I found out a solution, it is pretty easy.