I have tried to implement the solution from this answer but I just haven't been able to get it to work. I get 'Use of unresolved identifier...' for the variables I am trying to access..
I have a loginViewController.swift that gets the username and password when someone logs in..
import UIKit
class loginViewController: UIViewController {
@IBOutlet weak var userEmailTextField: UITextField!
@IBOutlet weak var userPasswordTextField: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func loginButtonTapped(sender: AnyObject) {
let userEmail = userEmailTextField.text;
let userPassword = userPasswordTextField.text;
Then I have a PostService.swift file that gets data from a MySQL database.. It should use the username of the person logged in to access the relevant data..
import Foundation
class PostService {
var settings:Settings!
let userEmail = "steve@centrix.co.za"; //This is hard coded but needs to come from the loginViewController
let userPassword = "1234"; //This is hard coded but needs to come from the loginViewController
I have tried that and a few other suggestions and I just don't seem to be able to get it to work.. Please help..
Thanks in advance.