From 337ebc07a3a114a815d195e8d90d1d1c3cc5e786 Mon Sep 17 00:00:00 2001 From: Laurent Date: Tue, 13 Feb 2024 11:19:43 +0100 Subject: [PATCH] update --- PadelClub/Views/ContentView.swift | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/PadelClub/Views/ContentView.swift b/PadelClub/Views/ContentView.swift index ac7f0e1..b634467 100644 --- a/PadelClub/Views/ContentView.swift +++ b/PadelClub/Views/ContentView.swift @@ -40,9 +40,23 @@ struct ContentView: View { } func _add() { - let id = (0...1000000).randomElement()! - let club: Club = Club(name: "test\(id)", address: "some address") - self.dataStore.clubs.addOrUpdate(instance: club) +// let id = (0...1000000).randomElement()! +// let club: Club = Club(name: "test\(id)", address: "some address") +// self.dataStore.clubs.addOrUpdate(instance: club) + + for _ in 0...20 { + var clubs: [Club] = [] + for _ in 0...20 { + let id = (0...1000000).randomElement()! + let club: Club = Club(name: "test\(id)", address: "some address") + clubs.append(club) + } + do { + try self.dataStore.clubs.append(contentOfs: clubs) + } catch { + Logger.error(error) + } + } } }