I have a view with an array:
@State private var categoria = [ "Acessórios para Veículos", "Agro", "Alimentos e Bebidas", "Animais",
and a foreach loop
ForEach(categoria, id: .self) { categoria in NavigationLink(destination: Destino(categoria: $categoria)) { Text(categoria) }
in other view (Destino) i want to receive the categoria of selected by user.
i try @Binding var categoria: [String]
ForEach(viewModel2.anuncios.filter({ "($0)".contains(categoria[?]) })) { anuncio in ClassRowView(anuncio:anuncio) }
But i neet to use [?] and i dont have the exact array that the user selected. Can u help me? how i can pass the correct value in contains(categoria) ?
Thanks!!