diff --git a/pass/LabelTableViewCell.swift b/pass/LabelTableViewCell.swift index 4dee5e9..fa85d20 100644 --- a/pass/LabelTableViewCell.swift +++ b/pass/LabelTableViewCell.swift @@ -8,10 +8,24 @@ import UIKit + +struct LabelTableViewCellData { + var title: String + var content: String +} + class LabelTableViewCell: UITableViewCell { @IBOutlet weak var contentLabel: UILabel! @IBOutlet weak var titleLabel: UILabel! + + + var cellData: LabelTableViewCellData? { + didSet { + titleLabel.text = cellData?.title + contentLabel.text = cellData?.content + } + } override var canBecomeFirstResponder: Bool { get { diff --git a/pass/PasswordDetailTableViewController.swift b/pass/PasswordDetailTableViewController.swift index 7c55903..c2c5753 100644 --- a/pass/PasswordDetailTableViewController.swift +++ b/pass/PasswordDetailTableViewController.swift @@ -75,8 +75,10 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "labelCell", for: indexPath) as! LabelTableViewCell - cell.titleLabel.text = tableData[indexPath.section].item[indexPath.row].title - cell.contentLabel.text = tableData[indexPath.section].item[indexPath.row].content + + let titleData = tableData[indexPath.section].item[indexPath.row].title + let contentData = tableData[indexPath.section].item[indexPath.row].content + cell.cellData = LabelTableViewCellData(title: titleData, content: contentData) return cell }