multistore
Laurent 2 years ago
parent a4f42f32c4
commit d501125499
  1. 2
      PadelClub/ContentView.swift
  2. 3
      PadelClub/Data/Club.swift
  3. 4
      PadelClub/Data/DataStore.swift
  4. 3
      PadelClub/Data/Tournament.swift

@ -10,7 +10,7 @@ import LeStorage
struct ContentView: View {
@ObservedObject var dataStore = DataStore()
@StateObject var dataStore = DataStore()
var body: some View {
VStack {

@ -9,7 +9,8 @@ import Foundation
import LeStorage
class Club : Storable, ObservableObject {
static var resourceName: String = "clubs"
static func resourceName() -> String { return "clubs" }
var id: String = Store.randomId()
var name: String

@ -13,8 +13,8 @@ class DataStore : ObservableObject {
// fileprivate var _store: Store
@ObservedObject fileprivate(set) var tournaments: StoredCollection<Tournament>
@ObservedObject fileprivate(set) var clubs: StoredCollection<Club>
@Published fileprivate(set) var tournaments: StoredCollection<Tournament>
@Published fileprivate(set) var clubs: StoredCollection<Club>
init() {
let store = Store.main

@ -9,8 +9,7 @@ import Foundation
import LeStorage
class Tournament: Storable {
static var resourceName: String = "tournaments"
static func resourceName() -> String { "tournaments" }
var id: String = Store.randomId()
var name: String

Loading…
Cancel
Save