I'd like to tie a core-data entity to a UITextField so that whenever the the textField finishes editing, it will automatically update the core-data object.
Here's how I'd like it work– not sure if it's possible.
user
is a core-data entityuser.gender
is a field of that entitygenderField
is a UITextFieldgenderField.coreDataObject
is a NSManagedObject property- A user types content into a
genderField
- On finish, the
genderField
firesdidEndEditing
- In
didEndEditing
, thegenderField
sets theuser.gender
by sayinggenderField.coreDataObject = genderField.text
- A user types content into a
The problem is that the coreDataObject is the user
and not user.gender
. So, first of all, you can't set the coreDataObject
equal to a string.
I need to store coreDataObject
but then somehow set coreDataObject.gender = genderField.text
Thanks.