4

I want to check the network speed from my swift application. I have found many posts describing the Reachability class specially the way of finding if the connection is reachable or not and if it's a WIFI connection or a WWAN one.

My question: Is it possible to detect the type of the WWAN (2G, 3G, 4G...)?

Ne AS
  • 1,490
  • 3
  • 26
  • 58

1 Answers1

3

You're able to check this with CoreTelephony. For example:

let telInfo = CTTelephonyNetworkInfo()
if telInfo.currentRadioAccessTechnology == CTRadioAccessTechnologyLTE {
    // Device has a LTE connection
}

You can find a list of all the CTRadioAccessTechnology here.

Hopefully this helps!

Spidy
  • 1,137
  • 3
  • 28
  • 48
naturaln0va
  • 755
  • 6
  • 8
  • Thank you for your answer. Can you tell me please if this [link](http://stackoverflow.com/questions/34668588/cttelephonynetworkinfos-currentradioaccesstechnology-ambiguous-response) contains all the WWAN types? Because I searched a lot for a list of all the WWAN types in iOS syntax but I didn't find it – Ne AS Sep 20 '16 at 08:24
  • I updated my answer with a link to the list of the constants. – naturaln0va Sep 20 '16 at 11:43
  • Look in the header files. They contain the _definitive_ list. – gnasher729 Feb 10 '20 at 11:21