Git, Linus Torvald’s version control system, is pretty unescapable nowadays. I methodically installed Git in a basic Xcode Swift project, along with Git-Crypt. The latter allows you to encrypt certain of the files that you published using Git.
Publishing source code while encrypting a file or two may sound like a strange combination. But it allows you to have an open-source application, while requiring others who are really interested to go get their own credentials or license for something specific which the public source code depends on.
The approach described here demonstrates the
git-crypt approach of deliberately giving you the file containing the sensitive line(s) in encrypted form. You may or may not be able to decrypt it – depending on whether you have the decryption key. The point here is to allow you to build and even run the app even if the secret key is unavailable: the file containing the secret isn’t missing, it just has unusable contents.
The article/README.md includes a (skipable) stepwise description of the process to do this from scratch. You might wonder why document all this if the source to my GitCryptDemo is freely available. But in this particular case, just having the source code simply isn’t enough, because it involves multiple configuration steps done outside of Xcode. And various of these steps are a bit tricky.