mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-03-21 00:49:30 +01:00
39 lines
847 B
Swift
Executable File
39 lines
847 B
Swift
Executable File
/*
|
||
See LICENSE folder for this sample’s licensing information.
|
||
|
||
Abstract:
|
||
A single row to be displayed in a list of landmarks.
|
||
*/
|
||
|
||
import SwiftUI
|
||
|
||
struct LandmarkRow: View {
|
||
var landmark: Landmark
|
||
|
||
var body: some View {
|
||
HStack {
|
||
landmark.image(forSize: 50)
|
||
Text(verbatim: landmark.name)
|
||
Spacer()
|
||
|
||
if landmark.isFavorite {
|
||
Image(systemName: "star.fill")
|
||
.imageScale(.medium)
|
||
.foregroundColor(.yellow)
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
#if DEBUG
|
||
struct LandmarkRow_Previews: PreviewProvider {
|
||
static var previews: some View {
|
||
Group {
|
||
LandmarkRow(landmark: landmarkData[0])
|
||
LandmarkRow(landmark: landmarkData[1])
|
||
}
|
||
.previewLayout(.fixed(width: 300, height: 70))
|
||
}
|
||
}
|
||
#endif
|