I've been working on this for three nights and have pretty much lost my weekend, so I would appreciate your help.
I'm being told that I'm not instantiating - I'm not 100% sure of how that works, I have read online but would like to see an example that has to do with my particular code.
In the app delegate I have this:
var myDataSource: Array<Dictionary<String,Any>>!
Then, on my first screen I want to capture the username to myDataSource (my array of dictionary's). I attempted this with:
class UserInfoViewController: UIViewController {
@IBOutlet weak var firstName: UITextField!
var userName: String?
@IBAction func submitName(_ sender: UITextField) {
userName = firstName.text
if userName != nil {
let saveName: [String: Int] = ["userName!": 0]
myDataSource.append(saveName)
print(firstName)
}
}
I have knowledge about unwrapping variables, however I think this has to do with instantiation, please tell me if I'm wrong.