From 6b01813c83569c6d2d54c1c3fdd750e6c1a5f537 Mon Sep 17 00:00:00 2001 From: Carlos McEvilly Date: Thu, 16 Jan 2025 17:17:14 -0800 Subject: [PATCH] DEMRUM-620: swiftlint: remove needless self references and fix whitespace --- .../AgentTestApp/ViewController.swift | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/AgentTestApp/AgentTestApp/ViewController.swift b/AgentTestApp/AgentTestApp/ViewController.swift index 9c894880..9a1e86d4 100644 --- a/AgentTestApp/AgentTestApp/ViewController.swift +++ b/AgentTestApp/AgentTestApp/ViewController.swift @@ -22,36 +22,37 @@ class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSour override func viewDidLoad() { super.viewDidLoad() - + // Register the table view cell class and its reuse id - self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: cellReuseIdentifier) - + tableView.register(UITableViewCell.self, forCellReuseIdentifier: cellReuseIdentifier) + // This view controller itself will provide the delegate methods and row data for the table view. tableView.delegate = self tableView.dataSource = self } - + // number of rows in table view func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return self.displayName.count + return displayName.count } - + // create a cell for each table view row func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - + // create a new cell if needed or reuse an old one - let cell:UITableViewCell = (self.tableView.dequeueReusableCell(withIdentifier: cellReuseIdentifier) as UITableViewCell?)! - + let cell: UITableViewCell = (self.tableView.dequeueReusableCell(withIdentifier: cellReuseIdentifier) as UITableViewCell?)! + // set the text from the data model - cell.textLabel?.text = self.displayName[indexPath.row] - + cell.textLabel?.text = displayName[indexPath.row] + return cell } - + // method to run when table view cell is tapped func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - print("You tapped row \(indexPath.row), for \(self.displayName[indexPath.row])") - - self.performSegue(withIdentifier: self.segueName[indexPath.row], sender: self) + print("You tapped row \(indexPath.row), for \(displayName[indexPath.row])") + + performSegue(withIdentifier: segueName[indexPath.row], sender: self) } } +