-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnterEmailViewController.swift
More file actions
90 lines (58 loc) · 2.24 KB
/
Copy pathEnterEmailViewController.swift
File metadata and controls
90 lines (58 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//
// EnterEmailViewController.swift
// Absinthe-iOS
//
// Created by Mitchell Kahn on 9/20/16.
// Copyright © 2016 AppDelegates. All rights reserved.
//
import UIKit
class EnterEmailViewController: RegSceneBaseViewController {
@IBOutlet var emailLabel: UILabel!
@IBOutlet var emailTextField: UITextField!
@IBOutlet var emailGoodCheck: UIImageView!
@IBOutlet var nextButton: UIButton!
var emailOK = false
override func viewDidLoad() {
super.viewDidLoad()
emailLabel.alpha = 0
nextButton.alpha = 0
emailGoodCheck.alpha = 0
UIView.animate(withDuration: 0.65, animations: {
self.emailLabel.alpha = 1
})
NotificationCenter.default.addObserver(self, selector: #selector(checkEmail), name: NSNotification.Name.UITextFieldTextDidChange, object: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: UITextField Delegate
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
log.debug("Delegate: should return")
return true
}
func textFieldDidEndEditing(_ textField: UITextField) {
log.debug("Delegate: did end editing")
//checkNames()
}
func textField(_ textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {
return true
}
func checkEmail(_ notification: Notification){
if let email = emailTextField.text {
if email.isValidEmail() && emailGoodCheck.alpha == 0 {
fadeIn(emailGoodCheck)
fadeIn(nextButton)
emailOK = true
}
if !email.isValidEmail() {
fadeOut(emailGoodCheck)
fadeOut(nextButton)
emailOK = false
}
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
Settings.sharedInstance.userEmail = emailTextField.text
}
}