I have a similar problem. There is a not elegant solution: force cast.
switch item:
case is Item1
let binding = Binding(...)
RowView(item: binding)
default:
fatelError("Unknown Item")
}
Post
Replies
Boosts
Views
Activity
Same problem if I append a value to path (NavigationPath).
Tested in Xcode 14 beta 5
How about:
ForEach(department.students) { student in
Text(student.name)
}
You should extract a variable for the name.
let tmp = other.name
#Predicate<OnlyName> { $0.name == tmp }
@Relationship(.nullify, inverse: \Group.members) var group: Group
group must be optional
Deleted
It seems no method to get the mainContext injected in environment directly, and the context is not sendable, you can not use it on other actor/thread. But you can get the context from your model like model.context.
actor BackgroundActor: ModelActor {
nonisolated public let executor: any ModelExecutor
init(container: ModelContainer) {
let context = ModelContext(container)
executor = DefaultModelExecutor(context: context)
}
func run(task: (ModelContext) -> Void) {
task(context)
}
}
You can use this wrapper like this:
databaseActor.run { context in
// ....
}
AFAIK Create a view history table and apply cascade rule