Thanks for this, I had to move to your 'if' workaround after installing Firebase Firestore. As I was getting the following error:
ld: warning: ignoring duplicate libraries: '-lc++'
ld: framework 'FirebaseFirestoreInternal' not found
clang++: error: linker command failed with exit code 1 (use -v to see invocation)