Post

Replies

Boosts

Views

Activity

Missing argument for parameter 'verbatim' in call when compiling code
import SwiftUI struct PokemonDetailView: View {   @EnvironmentObject var vm: ViewModel   let pokemon: Pokemon       var body: some View {     VStack {       PokemonView(pokemon: pokemon)               VStack(spacing: 10) {         Text("ID: (vm.pokemonDetails?.id ?? 0)")         Text("Weight: (vm.formatHW(value: vm.pokemonDetails?.weight ?? 0)) KG")         Text("Height: ((vm.formatHW(value: vm.pokemonDetails?.height ?? 0)) M")       }       .padding()     }     .onAppear {       vm.getDetails(pokemon: pokemon) }   }     } struct PokemonDetailView_Previews: PreviewProvider {   static var previews: some View {     PokemonDetailView(pokemon: Pokemon.samplePokemon)       .environmentObject(ViewModel())   } }
0
0
297
Feb ’23
when compiling code in swiftui, returns with error message
import SwiftUI struct PokemonDetailView: View {   @EnvironmentObject var vm: ViewModel   let pokemon: Pokemon       var body: some View {     VStack {       PokemonView(pokemon: pokemon)               VStack(spacing: 10) {         Text("ID: (vm.pokemonDetails?.id ?? 0)")         Text("Weight: (vm.formatHW(value: vm.pokemonDetails?.weight ?? 0)) KG")         Text("Height: ((vm.formatHW(value: vm.pokemonDetails?.height ?? 0)) M")       }       .padding()     }     .onAppear {       vm.getDetails(pokemon: pokemon) }   }     } struct PokemonDetailView_Previews: PreviewProvider {   static var previews: some View {     PokemonDetailView(pokemon: Pokemon.samplePokemon)       .environmentObject(ViewModel())   } } "error message" : in line:     Text("ID: (vm.pokemonDetails?.id ?? 0)")         Text("Weight: (vm.formatHW(value: vm.pokemonDetails?.weight ?? 0)) KG")         Text("Height: ((vm.formatHW(value: vm.pokemonDetails?.height ?? 0)) M") "Cannot call value of non-function type 'Binding' Referencing subscript 'subscript(dynamicMember:)' requires wrapper 'EnvironmentObject.Wrapper' insert '$' Value of type 'ViewModel' has no dynamic member 'formatHW' using key path from root type 'ViewModel'"
2
1
730
Feb ’23