Re: Objective-C: What is the current preferred method of declaring constants without a .pch?
On Oct 20, 2017, at 07:29 , Fritz Anderson <anderson.fritz@...> wrote:
Except of course that the tradition of *pure C* programming has assimilated this as standard programming technique: the compilation of one package is modified by pre-inserting macro definitions that modify the outcome of the package’s own macro definitions. Indeed, the use of environment variables as macros available to the compiler is much the same thing.
However, what I really wanted to say is that precompilation may still be useful *within* a large module such as the main application target. In that case, there may be a standard set of imports used in most source files, comprising multiple modules as well as multiple header files, and it *may* be beneficial to precompile all of that into a single, loadable file.
I think a more accurate statement about precompiled headers would say:
— Module inclusion is probably preferable to precompilation of the same declarations.
— Precompilation of non-module (i.e. intra-target) declarations is of no use to Swift code because it doesn’t have monolithic, linear compilations like C does.