I am so sorry for the confusion, here is everything:
struct Final_Restaurant_View: View {
var data: [RestaurantListViewModel]
@State private var isHome = false
var body: some View {
NavigationView{
VStack {
if data.count == 0 {
Text("No Picks Found")
}else {
List(data) {
data in
Section(header: Text("GroupPicks")) {
layout(data: data)
}
// layout(data: data)
}
.listStyle(GroupedListStyle())
}
Button(action: {
isHome = true
}, label: {
Text("Go Home")
})
.padding()
}
.fullScreenCover(isPresented: $isHome, content: {
ContentView(join: false)
})
.navigationBarTitle("Results")
}
}
}
struct layout: View {
var data: RestaurantListViewModel
var body: some View {
HStack {
URLImage(data.imageUrl) { image in
image
.resizable()
.aspectRatio(contentMode: .fill)
.clipped()
.frame(maxWidth: 30, maxHeight: 30)
.padding()
}
Text(data.name)
.padding()
HStack {
(Star Rating Logic
}
Button(action: {
print("opening site pressed")
if let url = URL(string: data.url) {
UIApplication.shared.open(url)
}
}) {
// Text("More Info")
Image("yelp logo")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(maxWidth: 30)
}
}
}
}