Objective-C has directives like:
- @interface
- @implementation
- @end
- @protocol
- @property
- @synthesize
I think of these things, such as complex marco or code generators. Is it possible to create custom directives for code generation? One possible use case is to create CoreData methods.
I do not think because I have never seen anything about it, but my world is not the world.
Follow up question:
Jonathan mentioned below that you can write your own preprocessor, and this asks the question of how to do this. Currently, #define SYMBOLIC_CONSTANT 102 will replace all instances of the SYMBOLIC_CONSTANT characters with the characters 102 in the file before the files go to the compiler.
I know that Xcode you can add โRun Script Phaseโ to the Targets build process. Therefore, I could write Script to find my custom preprocess directives, such as "$ coredata", and then create a new Script file, which with $ coredata characters is replaced by some code characters. But from what I understand during the Xcode build process, you cannot transfer modified files to the compiler source phase. Files are listed and locked using the IDE.
Has anyone done something like this? I know that this is possible with an external build system, but to be honest, I'm not at that level of understanding. I donโt know the technical details of what the Build and Run button does.
In the meantime, I will start reading the Apple Xcode documentation ...
Thanks for answers!
Tobias
source share