Home > Mobile >  TableView can't do segue when TableViewCell is selected
TableView can't do segue when TableViewCell is selected

Time:09-05

I come here to ask for help for a small problem that is occurring in the development of this application.

I have little experience with Swift, and I’m writing some code to learn more. I have this application that has in the initial screen a set of buttons that redirects to different pages and features.

The button called "Table View (CH Cantons)" redirects to a new view, which contains a TableView that show us three things:

  • Canton emblem or coat of arms
  • The Canton, as title : Ex: ZH - Zurich
  • The area of specific canton

When a canton is selected the application should forward to a new page and show details about that particular canton, but this is not happening despite my efforts to solve the problem. Is TableView required to be in the Main View / Main Page?

enter image description here

Bellow is the connection with the Navigation controller

enter image description here

The code that generates the Table View

let cantonsData = ["AG - Aargau","BE - Bern","GE - Geneve","GR -  Graubunden","JU - Jura","LU - Lucern","NE - Neuchâtel","SG - Sankt Gallen","TG - Thurgau","TI - Ticino","UR - Uri","VD - Vaud","VS - Valais","ZH - Zurich","AI - Appenzell \n Innerrhoden","AR - Appenzell \n Ausserrhoden","SH - Schaffhausen","BL - Basel \n Landschaft","BS - Basel","SO - Solothurn","FR - Fribourg","ZG - Zug","GL - Glarus","NW - Nidwald","OW - Obwald", "SZ - Schwyz"]
    
    let area = ["Area (km2): 1404 km2","Area (km2): 5,960 km2","Area (km2): 1,792 km2","Area (km2): 7,105 km2","Area (km2): 839 km2","Area (km2): 1,494 km2","Area (km2): 802 km2 ","Area (km2): 2031 km2","Area (km2): 992 km2","Area (km2): 2812 km2","Area (km2): 1077 km2","Area (km2): 3212 km2","Area (km2): 5224 km2","Area (km2): 1729 km2","Area (km2): 172 km2","Area (km2): 243 km2","Area (km2): 298 km2","Area (km2): 518 km2","Area (km2): 37 km2","Area (km2): 790 km2","FR - Fribourg","ZG - Zug","GL - Glarus","NW - Nidwald","OW - Obwald", "SZ - Schwyz"]
    
    override var modalPresentationStyle: UIModalPresentationStyle {
        get { .fullScreen }
        set { assertionFailure("Shouldnt change that            
  • Related