What is a Prefix.pch file?
PCH in prefix.pch stands for Pre-Compiled Header. This type of file contains pre-compiled headers which were invented to make compiling faster. As a prefix header files are parsed only once, it makes compilation a lot faster.
- Add all the import files that you would want in a prefix header.
- Open Build Settings under Apple LLVM Language Section and provide the full path to the Prefix Header.
- In the image attached below, I have added “GoogleAuthentication.pch” file path ro the prefix header section.
** If your file is located in any folder then mention the address as: “folder_name/file_name.pch”
- Enable Precompile Prefix Header so that the files get precompiled.
A prefix header is implicitly included at the start of every source file.
Each source file adds #import “prefix.pch” at the beginning of every code file before anything else.