Module 2 challenge 15

I have code similar with solution and looking through I am getting this error at the bottom of code where we need to create a dummy it says something about - Extra arguments at position 1,2,3,4 in call
another error: Missing argument for parameter “from” in call insert from
Thank you :slight_smile:

//
//  PizzaView.swift
//  Pizza
//
//  Created by Ewa Boer on 29/05/2021.
//

import SwiftUI

struct PizzaView: View {
    
    
    
    var pizza:Pizza
    var body: some View {
        
           
                
                   
                    
                       
                HStack {
                    Image(pizza.image)
                        .resizable()
                        .scaledToFill()
                        .frame(width: 50, height: 50, alignment: .center
                        )
                        .clipped()
                    
                    VStack {
                        Text(pizza.name)
                        HStack {
                                   
                                    ForEach (pizza.toppings, id:\.self) {
                                        top in
                                        
                                    Text(top)
                                    }
                        }
                    }
                }
                    
                
            
            
          
        
    }
}

struct PizzaView_Previews: PreviewProvider {
    static var previews: some View {
        
        PizzaView(pizza: Pizza(id: UUID(), name: "Test", toppings: ["topping1", "toppping2"], image: "meatlovers"))
    }
}

1 Like

@ewaperl

Hi Ewa,

Comment out the PreviewProvider struct for the moment and see if your code will run in the simulator.

Just a thought… is your Pizza data model a struct or a class?

2 Likes

it was class i changed to the struct, and it worked thank you :slight_smile:

1 Like