Veronica G Veronica G - 8 months ago 40
Swift Question

Segue texfields to a string array

I'm doing an app using swift that takes the entries in 6 text fields and passes them through a segue into an empty string array on a second view controller. How do I do that?

This is my code, is the basics, but I'm not sure how I can send the information through.

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

let destination = segue.destinationViewController as! secondView

if segue.identifier == segueID {

destination.stringArray = ?



The array on my second view controller is this:

var stringArray = [String]()


The shortest way:

destination.stringArray = view.subviews.flatMap { ($0 as? UITextField)?.text }