Table view set up question

I am trying to use the following data model to create a table view.

I have 3 questions?

  • where can I find more detailed information to set up table views?

  • how do I set up my section statement in the case I want to use a dictionary/array? (actionGoal)

in 'numberOfsections' and 'titleForHeaderinSection'

  • how do I set up an int and an dictionary/array in 'cellForRowAt'.

This is the data model.


import Foundation



struct ActionResult: Codable {

    let data: [ActionElement]

}



struct ActionElement: Codable {

    let actionID: Int

    let actionItem: String

    let actionGoal: ActionGoal

    let actionImage: String

    let actionBenefit: ActionBenefit

    let actionSavings: Int

    let actionType: ActionType

    let actionDescription, actionTips: String

    let actionInformationURL: String

    let actionSponsorURL: String



    enum CodingKeys: String, CodingKey {

        case actionID = "ActionID"

        case actionItem = "ActionItem"

        case actionGoal = "ActionGoal"

        case actionImage = "ActionImage"

        case actionBenefit = "ActionBenefit"

        case actionSavings = "ActionSavings"

        case actionType = "ActionType"

        case actionDescription = "ActionDescription"

        case actionTips = "ActionTips"

        case actionInformationURL = "ActionInformationURL"

        case actionSponsorURL = "ActionSponsorURL"

    }

}



enum ActionBenefit: String, Codable {

    case costs = "Costs"

    case education = "Education"

    case environment = "Environment"

    case health = "Health"

}



enum ActionGoal: String, Codable {

    case cleanEnergy = "Clean Energy"

    case cleanWater = "Clean Water"

    case climateAction = "Climate Action"

    case economicGrowth = "Economic Growth"

    case goodHealth = "Good Health"

    case noPoverty = "No *******"

    case promoteEquality = "Promote Equality"

    case qualityEducation = "Quality Education"

    case responsibleConsumption = "Responsible Consumption"

    case zeroHunger = "Zero Hunger"

}



enum ActionType: String, Codable {

    case sticky = "Sticky"

    case todoe = "Todoe"

}



typealias Action = [ActionElement]


This is the code for the sections:


        return result?.data.count ?? 0

            

          }



    override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {

        return result?.data[section].actionGoal

       }

Error: Type of expression is ambiguous without more context.

And this is the 'cellForRowAt' code:


                cell.actionBenefit.text = action?.actionBenefit

                cell.actionSavings.text = action?.actionSavings

error codes:

Cannot assign value of type 'ActionType?' to type 'String?' Cannot assign value of type 'Int?' to type 'String?'

I know I have asked this type of question before but I am trying to understand the concept. Please support me.

Table view set up question
 
 
Q