How to solve ios issue about UITableViewCell textLabel deprecated
When I practice ios app, I encounter warning about UITableViewCell's deprecated function.
The detail of warning is " 'textLabel' will be deprecated in a future version of iOS: Use UIListContentConfiguration instead, this property will be deprecated in a future release. "
The solution code for this warning is below:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "myCell", for: indexPath)
var content = cell.defaultContentConfiguration()
content.text = items[(indexPath as NSIndexPath).row]
content.image = UIImage(named: itemsImageFile[(indexPath as NSIndexPath).row])
cell.contentConfiguration = content
return cell
}