Learn Courses My Dashboard

Module 4, Lesson 7, Help!

I tried to copy the same code from the lesson, but it still shows an error

//  RecipieFeaturedView.swift
//  Recipe List App
//  Created by Sam Grover on 12/06/22.

import SwiftUI

struct RecipieFeaturedView: View {
    @EnvironmentObject var model: RecipeModel
    var body: some View {
                index in
                if model.recipes[index].featured == true{
            }.tabViewStyle(PageTabViewStyle(indexDisplayMode: .always))

struct RecipieFeaturedView_Previews: PreviewProvider {
    static var previews: some View {

You need to add id: \.self these days, re:

ForEach (0..<model.recipes.count, id: \.self) { index in

It wasn’t necessary until a few months ago, but now it is.


Thank you! I had the same problem.

1 Like

Also noted that’s a warning, not an error, so it isn’t “critical” yet to fix, but it could be in the future