I have code like
@IBOutlet weak var emailField: UITextField!
@IBOutlet weak var countryField: UITextField!
@IBOutlet weak var cityField: UITextField!
How can i put all this items to array so i can access each of them in a loop?
I have code like
@IBOutlet weak var emailField: UITextField!
@IBOutlet weak var countryField: UITextField!
@IBOutlet weak var cityField: UITextField!
How can i put all this items to array so i can access each of them in a loop?
@IBOutlet weak var emailField: UITextField!
@IBOutlet weak var countryField: UITextField!
@IBOutlet weak var cityField: UITextField!
...
let array = [emailField, countryField, cityField]
Have a look at the documentation on collection types
edit: you can split the declaration/init of that array
// outside any method
var array = [UITextField]?
// in viewDidLoad
self.array = [emailField, countryField, cityField]