-
Notifications
You must be signed in to change notification settings - Fork 2
/
HelperClass.swift
36 lines (29 loc) · 910 Bytes
/
HelperClass.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// HelperClass.swift
// PhotoViewer
//
// Created by Jhantelle Belleza on 8/18/17.
// Copyright © 2017 JhantelleB. All rights reserved.
//
import Foundation
import SwiftSpinner
class HelperClass {
static var isNetworkReachable: Bool {
get {
return checkReachability()
}
}
static let manager = NetworkStatus.reachabilityManager
fileprivate static func checkReachability() -> Bool {
guard (manager?.isReachable) == true else {
SwiftSpinner.show("Make sure device is connected to the internet.").addTapHandler({
SwiftSpinner.hide()
}, subtitle: "This app requires internet connection. Connect to a wifi or turn on mobile data. Tap to hide.")
return false
}
return true
}
static public func stopListening() {
manager?.stopListening()
}
}