Schuey999 Schuey999 - 4 months ago 11
Swift Question

How to return boolean value from a function in Swift

I've looked around but was suprised that I couldn't really find anything that explained this. If I have:

func checkEmail ()

{
var test = true

return test
}

...elsewhere in the code....

var emailStatus = checkEmail ()


How can I make this function return the boolean value of true?

Answer
func checkEmail() -> Bool {
   var test = true
   return test
}

Elsewhere in the code....

var emailStatus = checkEmail()