I have problem with this code. I try to append it but i get some error so please help

I have problem with this code. I try to append it but i get some error so please help

import SwiftUI

import CodeScanner



struct ScannerView: View {

    @State private var Produkt = handleprodukt

    @State var isPresentingScanner = false

    @State private var helpSheet = false

    @State var ScannedCode: String = "P"

    

    

    

    var scannerSheet : some View {

        CodeScannerView(

            codeTypes: [.ean13],

            completion: { result in 

                if case let .success(code) = result {

                    self.ScannedCode = code.string

                    self.isPresentingScanner = false

                    self.Produkt.append(ScannedCode)

                }

            }

        )

    }

    var body: some View {

        

        NavigationView {

            VStack {

                List {

                    

                    Section(header: Text("Produkt")) {

                        ForEach(Produkt, id: \.name) { item in

                            Text(item.name)

                                

                        }

                        .onDelete(perform: delete)

                    }

                    

                }

                .listStyle(PlainListStyle())

            }

            .navigationBarItems(trailing: Button(action: {

                self.isPresentingScanner = true

            }) {

                Image(systemName: "plus")

                

                    .sheet(isPresented: $isPresentingScanner) {

                        self.scannerSheet

                    }

            })

            .navigationBarItems(trailing: Button(action: {

                Produkt.removeAll()

            }) {

                Image(systemName: "trash")

            })

            .navigationBarItems(trailing: Button(action: {

                self.helpSheet = true

            }) {

                Image(systemName: "questionmark")

            })

            .alert("Hjelp", isPresented: $helpSheet, actions: {

                Button("Ok", action: {

                    print("ok")

                })

            }, message: {

                Text("Trykk + for å legge til produkt")

            })

            .navigationTitle("Scanner")

        }

        .navigationBarHidden(true)

        

        

    }

    func delete(at offsets: IndexSet) {

        Produkt.remove(atOffsets: offsets)

    }

    func addRow() {

        self.Produkt.append(ScannedCode)

    }

}
import SwiftUI

import Foundation





struct ScannProdukt: Identifiable {

    var id: String

    let name: String

}



var handleprodukt = [

    ScannProdukt(id: "1234567890128",name: "Orange sweater"),

    ScannProdukt(id: "1234567890129",name: "Blue sweater"),

]

The variable Produkt is of type Array<ScannProdukt>. In the addRow method, you are appending the value stored in ScannedCode to this array which is of type String.

The error comes from the fact that the array expects a value of type ScannProdukt to be appended, but instead got a value of type String.

You would need to use the ScannedCode property to create a ScannProdukt that can be appended to the Produkt array.

I have problem with this code. I try to append it but i get some error so please help
 
 
Q