48 lines
829 B
Swift
48 lines
829 B
Swift
//
|
|
// ListView.swift
|
|
// TheSwiftWeek
|
|
//
|
|
// Created by Ingo Rohlf on 21.10.25.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
//import Playgrounds
|
|
import Foundation
|
|
|
|
struct ListView: TabContent{
|
|
static var title = "List"
|
|
static var image = "list.bullet"
|
|
|
|
@State var bikes = Bike.all
|
|
var body: some View {
|
|
List {
|
|
Text(bikes[0].name)
|
|
Text(bikes[1].name)
|
|
Text(bikes[2].name)
|
|
}
|
|
List(bikes, id: \.name){ bike in
|
|
HStack {
|
|
Color(bike.color)
|
|
Text(String(bike.name))
|
|
}
|
|
}
|
|
List(bikes, id: \.name){
|
|
Text(String($0.price))
|
|
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
//#Playground {
|
|
// var students = ["Bill", "Linus"]
|
|
// let size = [1.65, 1.79]
|
|
//}
|
|
|
|
|
|
#Preview {
|
|
ListView()
|
|
}
|