Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func internetConnect() {
- NotificationCenter.default.addObserver(self, selector: #selector(internetChanged), name: Notification.Name.reachabilityChanged, object: reachability)
- do{
- try reachability.startNotifier()
- }catch{
- print("could not start reachability notifier")
- }
- }
- @objc func internetChanged(note: Notification) {
- let reachability = note.object as! Reachability
- if reachability.connection != .none{
- DispatchQueue.main.async {
- self.internetLabel.isHidden = true
- }
- }else{
- DispatchQueue.main.async {
- self.internetLabel.isHidden = false
- }
- }
- }
- func internetConnect(label:UILabel) {
- NotificationCenter.default.addObserver(self, selector: #selector(internetChanged), name: Notification.Name.reachabilityChanged, object: reachability)
- do{
- try reachability.startNotifier()
- }catch{
- print("could not start reachability notifier")
- }
- }
- selector: #selector(internetChanged)
Add Comment
Please, Sign In to add comment