Value of protocol type 'Any' cannot conform to 'Equatable'; only struct/enum/class types can conform to protocols code example

Example: Type '()' cannot conform to 'View'; only struct/enum/class types can conform to protocols foreach

Use (for i in is) instead 

var calorieAmount: Int {
    let calendar = Calendar.current
    let day = calendar.component(.day, from: entrydate)
    var calorieTotal = 0

    for food in foods {
        if food.date == day {
            calorieTotal += food.calories
        }
    }

    return calorieTotal
}

Tags:

Misc Example