Q:

Localhost on iOS

I have created an app using Xcode in Swift 3 which connects to MySQL via PHP. And I'm using xammp for the database.
When I test it on a real iPhone everything is working except the things that intereact with the database. I know it happens beceause the localhost isn't connected to my iPhone. 
So I wonder is there any way to test the app with the database on my iPhone?

A:

As you mentioned, your PHP URL may be pointing to localhost. From the iOS, the localhost is referring to the phone itself. So, it won't be able to find your PHP app. 
These are just speculations, so it is very important to share some code to clarify the problem. Meanwhile, here are some points to consider.

Make sure that your server PHP app is accessible by IP or hostname.(preferably IP).
Make sure that your iPhone is connected to the LAN as the host of the PHP app.
Change the URL of the PHP API to use the IP of the API host not localhost.

