I want to directly link a UITableView with a @Published attribute without using DiffableDataSouce.
If I make the person
struct Person {
let name: String
}
and create the data array:
@Published
var people = [Person(name: "Kim"), Person(name: "Charles")]
So I want to bind my UITableView directly, with something like:
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return $people.count()
}
But this gives the error
Cannot convert return expression of type 'Publishers.Count<Published[Person]>.Publisher>' to return type 'Int'