pomo_mondreganto
pomo_mondreganto

Reputation: 2074

Testing ping and server availability swift

For example, there's a site named site.com. I need to check if the site can be loaded and test the ping to the server the site is on. Can you provide anything to read or an example of code. I just can't find anything related to this topic

Upvotes: 3

Views: 5161

Answers (1)

Christian
Christian

Reputation: 22343

You can use an Objective-C library called SimplePingHelper from Chris Hulbert. It uses the Apple Code "SimplePing". You can find it on this GitHub Page.

Just import the .h file into your Bridging-Header file:

#import "SimplePingHelper.h"

Then you can use the SimplePingHelper like shown in the example on Chris' website. The code is written in Objective-c, but you can easily update it to Swift.

Upvotes: 3

Related Questions