Getting Data From all TableViewCells
<p>I am creating a flashcards app and right now I am creating the interface where the user creates the flashcards. I originally had it set up where the user could not add another card (add another UITableViewCell) until the current one had a term and definition. If the card was filled in, I would save the term and definition to a dictionary. What I realized part of the way through is that the user can go back to a previous cell and change the data in the cell and it would never be saved. My latest idea is to wait until the user finishes filling in all of the cells and then save the data. I can't seem to find a way to get the data of all of the cells.</p>

<p>What I have now in my <strong>tableViewController</strong>:</p>

<pre><code>// MARK: Variables

var cards = [Int]()

var cardData = [String : String]()



// MARK: Actions

@IBAction func plusBarButtonItemPressed(sender: AnyObject) {

    self.cards.append(self.cards.count + 1)

    let insertionIndexPath = NSIndexPath(forRow: self.cards.count - 1, inSection: 0)

    tableView.insertRowsAtIndexPaths([insertionIndexPath], withRowAnimation: .Automatic)

}


@IBAction func doneBarButtonItemPressed(sender: AnyObject) {

    // Save each cell into cardData [termTextView.text : definitionTextView.text]

}



// MARK: Functions

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {

    return self.cards.count
}
</code></pre>

<p>And here is what I have now in my <strong>custom tableViewCell</strong></p>

<pre><code>// MARK: Outlets

@IBOutlet var termTextView: UITextView!

@IBOutlet var definitionTextView: UITextView!
</code></pre>

<p>Again, my question: <strong>How can I get the text inside of the textViews inside all of the tableViewCells into a dictionary when a button (save) is pressed?</strong></p>

<p>Thanks for the help!</p>