-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add constant structs for the property names #72
Conversation
Sampling Mike Ash's post about namespaced constants (http://www.mikeash.com/pyblog/friday-qa-2011-08-19-namespaced-constants-and-functions.html), this adds the generation of constant structs to access the attribute, relationship and fetched property names. This makes sure that when you're creating a fetch request, you can use these values to guarantee their existence.
Sounds like an awesome addition, looking forward to using it. Should it be optionally enabled perhaps, instead of always on? Should be simple with template vars. |
I did wonder whether it should be optional, though I can't see too much harm in generating them and not using them, especially if it removes a preference. (Though I know the command line types love options!) |
[NEW] [Mike-Ash-style](http://www.mikeash.com/pyblog/friday-qa-2011-08-19-namespaced-constants-and-functions.html) namespaced constants for entity attribute names and relationships. Allows you to write things like `[mo valueForKey:PersonMOAttributes.hairColor]` instead of `[mo valueForKey:@"hairColor"]`. The main benefit here is the compile-time errors when the `hairColor` attribute is removed or renamed. (Daniel Tull)
I'm going to have it always-on. I don't see a big win being able to turn it off. |
--- Sampling Mike Ashs post about namespaced constants (http://www.mikeash.com/pyblog/friday-qa-2011-08-19-namespaced-constants-and-functions.html), this adds the generation of constant structs to access the attribute, relationship and fetched property names. This makes sure that when youre creating a fetch request, you can use these values to guarantee their existence.
These added structs are incompatible with ARC. I get compiler errors "error: ARC forbids Objective-C objects in structs or unions" |
Are you using the ARC flag ( |
@jdmuys, @danielctull thanks for clearing this up, it will go in v1.24's changelog |
--- Sampling Mike Ashs post about namespaced constants (http://www.mikeash.com/pyblog/friday-qa-2011-08-19-namespaced-constants-and-functions.html), this adds the generation of constant structs to access the attribute, relationship and fetched property names. This makes sure that when youre creating a fetch request, you can use these values to guarantee their existence.
[NEW] [Mike-Ash-style](http://www.mikeash.com/pyblog/friday-qa-2011-08-19-namespaced-constants-and-functions.html) namespaced constants for entity attribute names and relationships. Allows you to write things like `[mo valueForKey:PersonMOAttributes.hairColor]` instead of `[mo valueForKey:@"hairColor"]`. The main benefit here is the compile-time errors when the `hairColor` attribute is removed or renamed. (Daniel Tull)
Sampling Mike Ash's post about namespaced constants (http://www.mikeash.com/pyblog/friday-qa-2011-08-19-namespaced-constants-and-functions.html), this adds the generation of constant structs to access the attribute, relationship and fetched property names. This makes sure that when you're creating a fetch request, you can use these values to guarantee their existence.