You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
PadelClub/PadelClub/Views/ContentView.swift

52 lines
1.1 KiB

//
// ContentView.swift
// PadelClub
//
// Created by Laurent Morvillier on 02/02/2024.
//
import SwiftUI
import LeStorage
struct ContentView: View {
@StateObject var dataStore = DataStore()
var body: some View {
NavigationStack {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
List(self.dataStore.clubs) { club in
NavigationLink {
ClubView(club: club)
} label: {
Text(club.name)
}
}
}
Button("add") {
self._add()
}.padding()
.buttonStyle(.bordered)
}
}
func _add() {
let id = (0...1000000).randomElement()!
let club: Club = Club(name: "test\(id)", address: "some address")
self.dataStore.clubs.addOrUpdate(instance: club)
}
}
#Preview {
ContentView()
}