I found the solution was to add var id = UUID() to the model definition
so the final result would look something like:
@Model
final class Character {
var id = UUID()
var name: String
var production: Production?
var myCharacter: Bool
init(name: String, production: Production?, myCharacter: Bool = false) {
self.name = name
self.production = production
self.myCharacter = myCharacter
}
}
@Model
final class Production {
var id = UUID()
var name: String
@Relationship(deleteRule: .cascade, inverse: \Act.production) var acts: [Act] = []
init(name: String) {
self.name = name
}
}
Post
Replies
Boosts
Views
Activity
I was missing the { from ToolbarItem
var body: some View {
NavigationStack {
Text("Home")
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
NavigationLink {
AccountView()
} label: {
Image(systemName: "gearshape")
}
}
}
}
}