1
0

LandmarkRow.swift 882 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. See LICENSE folder for this sample’s licensing information.
  3. Abstract:
  4. A single row to be displayed in a list of landmarks.
  5. */
  6. import SwiftUI
  7. struct LandmarkRow: View {
  8. var landmark: Landmark
  9. var body: some View {
  10. HStack {
  11. landmark.image
  12. .resizable()
  13. .frame(width: 50, height: 50)
  14. Text(landmark.name)
  15. Spacer()
  16. if landmark.isFavorite {
  17. Image(systemName: "star.fill")
  18. .imageScale(.medium)
  19. .foregroundColor(.yellow)
  20. }
  21. }
  22. }
  23. }
  24. struct LandmarkRow_Previews: PreviewProvider {
  25. static var previews: some View {
  26. Group {
  27. LandmarkRow(landmark: landmarkData[0])
  28. LandmarkRow(landmark: landmarkData[1])
  29. }
  30. .previewLayout(.fixed(width: 300, height: 70))
  31. }
  32. }