I'm developing an iOS app and I have a UITableView
that generates UITableViewCell
s based on an array.
In other words, I have a custom cell, which has UIViews
inside of it.
How can I add a 2dimensional array which contains a Repo Label text and a URL Label text and generate a lot of cells with array.count
.
Here's my code:
class SourcesViewController: UITableViewController {
var array:[[String]] = [["Thunderbolt iOS Utilities", "https://repo.thunderbolt.semiak.dev"], ["Semiak's Repo", "repo.semiak.dev"]]
override func viewDidLoad()
{
super.viewDidLoad()
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
//How can I setup all the arguments my custom UITableViewCell needs?
return cell
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return array.count
}
}
Sorry if the explanation is really bad, I have never done this thing before, moreover, I'm new into iOS development so I do not know how to explain exactly what I need.