I am trying to port my application over to CloudKit. My app worked fine before, but then I made scheme of changes and am trying to deploy to a new container. For some reason, the database is not being created after I create the container through Xcode.
I think I have configured the app correctly and a container was created, but no records were deployed. My app current stores data locally on individual devices just fine but they don't sync with each other. That's why I would like to use CloudKit.
See screenshot from Xcode of where I have configured the container. I also have background notifications enabled. Also see screenshot from console where the container has been created, but no records have been.
Any suggestions would be greatly appreciated.
Thank you
Post
Replies
Boosts
Views
Activity
I am working on my first app to display a list of meals and their details. I have simplified the code for my question here but essentially a list of meals is presented and I should be able to click on one to go to a child view. I am experiencing a weird behavior where the first time I click on a meal the child comes up blank. If I then click on another meal and click back. the child view displays fine. any help you can give me would be greatly appreciated.
import SwiftUI
struct ContentView: View {
@State var meals: [Meal] = [
Meal(name: "filet steak"),
Meal(name: "pepperoni pizza"),
Meal(name: "pancakes"),
Meal(name: "full breakfast")
]
@State private var selectedMeal: Meal?
@State private var isShowingMealForm = false
var body: some View {
NavigationStack {
List {
ForEach(meals) { meal in
HStack {
Text(meal.name)
.font(.headline)
}
.onTapGesture {
self.selectedMeal = meal
isShowingMealForm = true
}
}
}
}
.sheet(isPresented: $isShowingMealForm) {
if let m = selectedMeal {
Text(m.name)
}
}
}
}
class Meal: Identifiable {
var id: UUID = UUID()
var name: String = ""
init() {}
init(id: UUID = UUID(), name: String)
{
self.id = id
self.name = name
}
}