Check for internet connection with Swift

To solve the 4G issue mentioned in the comments I have used @AshleyMills reachability implementation as a reference and rewritten Reachability for Swift 3.1: updated: Xcode 10.1 • Swift 4 or later Reachability.swift file import Foundation import SystemConfiguration class Reachability { var hostname: String? var isRunning = false var isReachableOnWWAN: Bool var reachability: SCNetworkReachability? var … Read more

How can I check for an active Internet connection on iOS or macOS?

Important: This check should always be performed asynchronously. The majority of answers below are synchronous so be careful otherwise you’ll freeze up your app. Swift Install via CocoaPods or Carthage: https://github.com/ashleymills/Reachability.swift Test reachability via closures let reachability = Reachability()! reachability.whenReachable = { reachability in if reachability.connection == .wifi { print(“Reachable via WiFi”) } else { … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)