hi,
the best i can make of your code is something like this, as the code for some View maybe named MyView
:
struct MyView: View {
var body: some View {
findLocations()
VStack {
MapView(myValue: myValue)
Spacer()
}
}
func findLocations() {
// let myCount = myLocations.count
// if myCount <= 1 {
// return mapView
// }
// for myLocation in myLocations {
// if (myLocation.date! >= WeeklySpan(increment: myValue) && myCount >= 1 ) {
// detailArray.append(myLocation.detail!)
// coordArray.append([myLocation.latitude, myLocation.longitude])
// }
}
}
there are too many undefined terms in what you've posted, and some of it might be commented out; but your question is why you're getting an error in this section of code:
var body: some View {
findLocations()
VStack {
MapView(myValue: myValue)
Spacer()
}
}
the body property must return a View; you have a function call (not a View) and a VStack, so you'd really want something like this:
var body: some View {
findLocations()
return VStack {
MapView(myValue: myValue)
Spacer()
}
}
we'll need more help from you going forward, so please be sure to include enough code to see all of what's going on.
hope that helps,
DMG