     /* =============================================================
     // Connectivity testing code
     =============================================================== */
-  public class func hasConnectivity() -> Bool {
+    class func hasConnectivity() -> Bool {
 
         var zeroAddress = sockaddr_in()
-        zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress))
+        zeroAddress.sin_len = UInt8(MemoryLayout<sockaddr_in>.size)
         zeroAddress.sin_family = sa_family_t(AF_INET)
 
-        guard let defaultRouteReachability = withUnsafePointer(&zeroAddress, {
-           SCNetworkReachabilityCreateWithAddress(nil, UnsafePointer($0))
+        guard let defaultRouteReachability = withUnsafePointer(to: &zeroAddress, {
+            $0.withMemoryRebound(to: sockaddr.self, capacity: 1) {
+                SCNetworkReachabilityCreateWithAddress(nil, $0)
+            }
         }) else {
             return false
         }

            return false
        }

        let isReachable = flags.contains(.Reachable)
        let needsConnection = flags.contains(.ConnectionRequired)

        return (isReachable && !needsConnection)
    }

//import netinet/in.h>
//#import <SystemConfiguration/SystemConfiguration.h>

class CheckConnectivitySwift: NSObject {

    static let sharedInstance: CheckConnectivitySwift = {
        let instance = CheckConnectivitySwift()
