Reputation: 6940
I want to add Reachability library to my app, and there is what we can read in doc:
//declare this property where it won't go out of scope relative to your listener
let reachability = try! Reachability()
So, what I did is:
Create Singleton object to do stuff:
class ReachabilityService {
static let shared = ReachabilityService()
private init() {}
private let reachability = try! Reachability()
}
Did add property to AppDelegate to keep it in memory for application life:
class AppDelegate: UIResponder, UIApplicationDelegate {
let reachability = ReachabilityService.shared
}
My question is, will reachability property in AppDelegate be in memory for all of application lifetime?
Upvotes: 0
Views: 72
Reputation: 350
Yes, the property declared in AppDelegate will be available throughout the lifecycle of the application.
Upvotes: 1