Im getting this error at onAppear when I try to get the data from data source and assign it to cities.Please help.Thanks a ton.
Cannot convert value of type ‘()’ to expected argument type ‘(() → Void)?’
this is my code
struct CityView: View {
var body: some View {
var datasource = DataSource()
@State var cities:[City] = [City]()
VStack{
Text("Hi")
}.onAppear(perform: cities = datasource.getData()). //error on this line
}
}