wip
This commit is contained in:
@ -12,23 +12,14 @@ struct CloudKitSyncObserver: ViewModifier {
|
||||
.onReceive(NotificationCenter.default.publisher(for: .cloudKitDataDidChange)) { _ in
|
||||
refreshID = UUID()
|
||||
Task { @MainActor in
|
||||
// do {
|
||||
// for entity in modelContext.container.schema.entities {
|
||||
// fetchAll<entity.Type>(of: entity.Type, from: modelContext)
|
||||
// }
|
||||
// } catch {
|
||||
// print("ERROR: failed to fetch data on CloudKit change")
|
||||
// }
|
||||
//
|
||||
// try? modelContext.fetch(FetchDescriptor<Exercise>())
|
||||
// try? modelContext.fetch(FetchDescriptor<ExerciseType>())
|
||||
// try? modelContext.fetch(FetchDescriptor<Muscle>())
|
||||
// try? modelContext.fetch(FetchDescriptor<MuscleGroup>())
|
||||
// try? modelContext.fetch(FetchDescriptor<Exercise>())
|
||||
// try? modelContext.fetch(FetchDescriptor<Exercise>())
|
||||
// try? modelContext.fetch(FetchDescriptor<Exercise>())
|
||||
// try? modelContext.fetch(FetchDescriptor<Exercise>())
|
||||
// TODO: add more entities?
|
||||
do {
|
||||
let _ = try await fetchAll(of: Exercise.self, from: modelContext)
|
||||
let _ = try await fetchAll(of: Split.self, from: modelContext)
|
||||
let _ = try await fetchAll(of: Workout.self, from: modelContext)
|
||||
let _ = try await fetchAll(of: WorkoutLog.self, from: modelContext)
|
||||
} catch {
|
||||
print("ERROR: failed to fetch \(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user