UITABLEVIEW-METHODEN
Delegate
  UITableViewDelegate, UITableViewDataSource

 override func viewDidLoad() {
   tableview.delegate=self
   tableview.dataSource=self
 }

Groups
Anzahl der Gruppen
 func numberOfSections(in tableView: UITableView) -> Int {
   return 1
 }


Set the spacing between sections
 func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
   return 50  // cellSpacingHeight
 }

Count of the elements
 func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
   return cities.count
 }

SelectecIndexChanged
 func tableView(_: UITableView, didSelectRowAt: IndexPath) {
   let row = (didSelectRowAt as NSIndexPath).row
   // Aktion
 }

Height of the cells
  func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
    switch (indexPath.row) {
      case 0:
        return 100
      case 3:
        return 80
      default:
         return UITableView.automaticDimension
    } // switch
 } 

Format-Definition of the cell (normal)
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  let cell: UITableViewCell = UITableViewCell(style: UITableViewCell.CellStyle.subtitle, reuseIdentifier: "reuseIdentifier")

  /* Typen
    UITableViewCellStyle.default          Bild links, Titel rechts
    UITableViewCellStyle.value1           Titel in der Mitte, rechts Zusatzinformation
    UITableViewCellStyle.value2           Zusatzinformation links, rechts Titel
    UITableViewCellStyle.subtitle         Bild links, Titel rechts, darunter Zusatzinformation
  */
    
  let row = (indexPath as NSIndexPath).row
  let city:City = cities[ row ]
  cell.textLabel?.text = city.name
  cell.detailTextLabel?.text = city.remark

  switch city.continent {
     case Continent.AFRICA:
        cell.imageView?.image = UIImage(named: "schwarz")
     case Continent.AMERICA:
        cell.imageView?.image = UIImage(named: "rot")
     default:
         cell.imageView?.image = UIImage(named: "default")
  }
  return cell
}







Format-Definition of the cell (user-definition)
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  let cell = tableView.dequeueReusableCell(withIdentifier: "mycell", for: indexPath) as! MyCell

  let row = (indexPath as NSIndexPath).row
   print("row:"+String(row))
      
   let city:City = cities[ row ]
   cell.title?.text = city.name
   cell.subtitle?.text = city.remark
          
    switch city.continent {
      case Continent.AFRICA:
          cell.imgContinent?.image = UIImage(named: "schwarz")
      case Continent.AMERICA:
          cell.imgContinent?.image = UIImage(named: "rot")
      default:
          cell.imgContinent?.image = UIImage(named: "default")
    }
    
    return cell
 }


Format-Definition of elements in the cell
textcolor
  cell.subtitle?.textColor = UIColor(named: "redColor")


backgroundColor
  cell.backgroundColor = UIColor(named: "lightyellowColor")

      
borderWidth
  cell.layer.borderWidth = 3


borderColor
  cell.layer.borderColor = UIColor.blue.cgColor


borderRadius
   cell.layer.cornerRadius = 25


Shadow of the cell
   cell.subtitle?.shadowColor = UIColor(named: "redColor")
   cell.layer.shadowColor = UIColor.orange.cgColor

Segue