Open pycoder-pjh opened 6 years ago
You can check isTransientConnectionFlagSet
You can use the following code:
private var isConnectedToVpn: Bool {
if let settings = CFNetworkCopySystemProxySettings()?.takeRetainedValue() as? Dictionary<String, Any>,
let scopes = settings["__SCOPED__"] as? [String:Any] {
for (key, _) in scopes {
if key.contains("tap") || key.contains("tun") || key.contains("ppp") || key.contains("ipsec") || key.contains("ipsec0") {
return true
}
}
}
return false
}
You can use the following code:
Thanks for a working answer. Is there a licensing issue in using this code snippet ?
Thanks
i need to connect to VPN, in order to access my ios application. Is there a way reachability works . Also need to alert user on this.. Please help me team..
Thanks in advance..