Я довольно новичок в Swift и пытаюсь настроить супер простое табличное представление, и ничего из того, что я пробовал, не сработало.Он строит без проблем, но моя таблица невидима на симуляторе.Что я делаю не так?
class ViewController: UIViewController, UITableViewDelegate,
UITableViewDataSource {
var currentNames: Array = ["Name1", "Name2", "Name3", "Name4", "Name5", "Name6", "Name7", "Name8", "Name9", "Name10"]
var currentDays: Array = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
@IBOutlet weak var tableView: UITableView!
public func tableView(_ tableView: UITableView,
numberOfRowsInSection section: Int) -> Int {
return currentNames.count
}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
let currDays = currentDays[indexPath.row]
cell.textLabel?.text = currentNames[indexPath.row]
cell.detailTextLabel?.text = String(currDays)
return(cell)
}
override func viewDidLoad() {
super.viewDidLoad()
tableView.delegate = self
tableView.dataSource = self
}