Код: Выделить всё
class HomeViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
let tableView = {
let t = UITableView(frame: .zero, style: .grouped)
t.dataSource = self
t.delegate = self
return t
}()
...
}
< /code>
Ошибка: < /p>
Cannot assign value of type '(HomeViewController) -> () -> HomeViewController' to type '(any UITableViewDataSource)?'
Код: Выделить всё
class HomeViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
lazy var tableView = {
let t = UITableView(frame: .zero, style: .grouped)
t.dataSource = self
t.delegate = self
return t
}()
...
}
Подробнее здесь: https://stackoverflow.com/questions/795 ... pe-homevie
Мобильная версия