How to save the text of 2 textfields in an array?
This is what I tried. I use println to check if the values are in the array. But it seems it doesn't work.
Can anyone explain it and please, explain each step. Thank you
1- I create a swift file: novaClass.swift. I create an struct inside
struct novaClass {
var img : String
var text : String
}
2- ViewController.swift Declare an array
var nouArray = [novaClass]()
3- save the text field in the array
@IBAction func save(sender: AnyObject) {
//I put the text of 2 text fields in the array
var nouText = novaClass(img: textField1.text, text: textField2.text)
nouArray.append(nouText)
//I check the array
println(nouArray) // this gives "[_.novaClass]" I do not understand
}