我是编码和堆栈溢出的新手,我试图让用户在关闭应用程序后仍然保持登录状态.我也不希望他们总是在屏幕上看到登录.即使关闭应用程序并重新打开应用程序,我该如何保持用户登录.我正在使用Swift 3.0,Xcode 8和Firebase.
import UIKit
import Firebase
import SwiftKeychainWrapper
class LoginViewController: UIViewController {
@IBOutlet weak var emailField: UITextField!
@IBOutlet weak var pwField: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(LoginViewController.dismissKeyboard))
//Uncomment the line below if you want the tap not not interfere and cancel other interactions.
//tap.cancelsTouchesInView = false
view.addGestureRecognizer(tap)
// Do any additional setup after loading the view.
}
func dismissKeyboard() {
//Causes the view (or one of its embedded text fields) to …Run Code Online (Sandbox Code Playgroud)