我想创建一个视图,允许用户编辑一个NSManagedObject实体,如下所示。
class Employee: NSManagedObject {
@NSManaged var name: String
}
struct EditEmpView : View {
@ObservedObject var empToEdit: Employee
var body: some View {
TextField("Name", text: $empToEdit.name)
}
}