Learn Courses My Dashboard

How can I get the ipadress of the host machine when my target is iOS in xcode?

I need to find the ipadress of the machine where I am running xcode during run time. Any workaround ?

You want to find the IP address of your computer?? Or using Swift to find the IP address?

To find it of your computer you go to system preferences → network and it’ll be listed by the connection type (like WiFi)

I have some service running on my local host. So to access that I need to find the ipadress of my machine via Swift code during runtime. When my target is iOS

This isn’t the way you should do it, because when running the app it won’t try to hit a specific IP address while running

You could use ngrok which gives your local host a URL to a specific port and from your app you hit that URL rather than your personal computer