-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDestinationsView.swift
More file actions
53 lines (48 loc) · 1.96 KB
/
DestinationsView.swift
File metadata and controls
53 lines (48 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
// DestinationsView.swift
// TravelGuide
//
// Created by Ankit Mane on 3/20/24.
//
import Foundation
import SwiftUI
struct DestinationsView: View {
@ObservedObject var viewModel = DestinationListViewModel()
var body: some View {
ZStack {
LinearGradient(gradient: Gradient(colors: [.blue, .white]),
startPoint: .topLeading,
endPoint: .bottomTrailing)
.edgesIgnoringSafeArea(.all)
ScrollView {
LazyVStack(spacing: 0) {
ForEach(viewModel.destinations, id: \.name) { destination in
NavigationLink(destination: DestinationDetailView(destination: destination)) {
HStack {
Image(destination.imageName) // Ensure you have these images in your assets
.resizable()
.frame(width: 50, height: 50)
.cornerRadius(10)
Text(destination.name)
Spacer()
Image(systemName: "chevron.right")
}
.padding()
.frame(maxWidth: .infinity, alignment: .leading)
.background(Color.white.opacity(0.5))
.cornerRadius(10)
.shadow(radius: 1)
.padding(.horizontal)
.padding(.vertical, 4)
}
.buttonStyle(PlainButtonStyle()) // Remove the button highlight effect on tap
}
}
}
.navigationTitle(XCS.travelDestinations.string)
}
.onAppear {
viewModel.loadDestinations() // Load destinations when the view appears
}
}
}