There is a great answer about how to use the specific DNS server to resolve a domain. Specify DNS to resolve an address … | Apple Developer Forums
I translating it into Swift and make it building success.
(Dropbox - SwiftDNS.zip - Simplify your life)
The <sys/socket.s> looks like could import via:
import Darwin.POSIX.sys.socket
However, the test build is not passing due to other library not linked. That is a lib named "libresolv.tbd" which contains <dns.h>. But I have no idea how to do it. The tbd file is not a normal lib.
How to link such a library in SwiftPM?
Thanks.