Xcode 12.5 use C library with swift

Search on this topic on the web is maddening, because nothing really seems to be complete. I'd like to ask for 2 pathways:

Library which comes with Xcode/macOS
  1. If I look at my target info panel in the project editor, I can add Frameworks and Libraries. I would like to add libpcre.

I hit the "+", scroll down and select libpcre.tbd. It dutifully adds an entry.

How do I now use this in a swift file, and see the various functions from the pcre library?

Library installed from homebrew

2. Say I have decided that pcre version 1 isn't enough, and I need to add libpcre2. I use "brew install pcre2", which installs the needed file in /usr/local/Cellar/pcre2/10.36/ .

How do I now show Xcode how to find these libraries, and use them in my swift file?


The Test
In both cases, my basic test is that I ought to be able to type

Code Block
let recode = pcre<TAB>


and have Xcode show me the various symbols from the included library.
Xcode 12.5 use C library with swift
 
 
Q