[ad_1]
I meant to show knowledge from my Firestore Database into my app utilizing the TableViewCell. It supposed to point out the bookTitle, bookAuthor and bookSummary however the bookAuthor doesn’t present up. Beneath is my code.
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell(fashion: .subtitle, reuseIdentifier: "cell")
cell.accessoryType = .disclosureIndicator
cell.textLabel?.textual content = books[indexPath.row].bookTitle
cell.textLabel?.font = .systemFont(ofSize: 20, weight: .medium)
cell.detailTextLabel?.textual content = books[indexPath.row].bookAuthor
cell.detailTextLabel?.textual content = books[indexPath.row].bookSummary
return cell
}
func setupTableView() {
view.addSubview(tableView)
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
tableView.allowsSelection = true
tableView.isUserInteractionEnabled = true
tableView.translatesAutoresizingMaskIntoConstraints = false
tableView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
tableView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
tableView.rightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.rightAnchor).isActive = true
tableView.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor).isActive = true
}
func tableView(_ tableView: UITableView, numberOfRowsInSection part: Int) -> Int {
return books.depend
}
[ad_2]
