Closed MichealSBingham closed 7 years ago
extension Date {
var age: Int {
return Calendar.current.dateComponents([.year], from: self, to: Date()).year!
}
}
@IBAction func didPressContinue(_ sender: Any) {
guard datePicker.date.age >= 13 else{
UIAlertView(title: "Sorry",
message: "You must be at least 13 years old to use Swap.",
delegate: nil,
cancelButtonTitle: "Ok").show()
return
}
// save birthday
self.performSegue(withIdentifier: "toEmailController", sender: nil)
}
Check that the user is > 13