Check connection from iOS device to server by Swift 4.X

i0S Swift Issue

Testing the connection from client to server is essential when developing a client/server application.

The idea of this is to use a URLSession to send a request to the server and check if the return date string exists.

Usage: Put the code below into any function you want to use.

You can also use this idea to get server time data in swift. This is useful when you develop an application that needs time synchronization between the client and server. >>> See more.