Using ifaddrs library in Swift

I cannot import ifaddrs into my Swift project. The compiler says:

There is no such module "ifaddrs"

The goal is to obtain an IPhone IP address in the current Wi-Fi network at the end. Any suggestions?

+4
source share
1 answer

Usually under your ** - Bridging-Header.h file you need to add: (where ** is the name of your project, xcode creates it for you when you turn on target resource c)

#include <arpa/inet.h>

#include <sys/socket.h>

#include <ifaddrs.h>

After ifaddrs is available under the fast file, the file with * -Bridging-Header.h is the bridge for the c / c object class to be used in swift.

+9
source

Source: https://habr.com/ru/post/1543783/


All Articles