SLRNetworkMonitor
Objective-C
@interface SLRNetworkMonitor : NSObject
Swift
class SLRNetworkMonitor : NSObject
@class SLRNetworkMonitor Provides a way of monitoring network connectivity on a device. Objects created with the default configuration create their own serial queue to handle events and then use the main queue to post notifications on.
-
The type of the monitor.
Declaration
Objective-C
@property (readonly) SLRNetworkMonitorType monitorType;Swift
var monitorType: SLRNetworkMonitorType { get } -
The current network path being monitored.
Declaration
Objective-C
@property (strong, readonly, nullable) nw_path_t currentPath;Swift
var currentPath: nw_path_t? { get } -
Designated initializer that creates a new instance of a
SLRNetworkMonitorof a specific type, work queue, & notification queue.Note
Use-initto get the default configuration.Declaration
Objective-C
- (nonnull instancetype)initWithMonitorType:(SLRNetworkMonitorType)monitorType workQueue:(nullable dispatch_queue_t)workQueue notificationQueue: (nullable dispatch_queue_t)notificationQueue;Swift
init(monitorType: SLRNetworkMonitorType, work workQueue: DispatchQueue?, notificationQueue: DispatchQueue?)Parameters
monitorTypeThe type of monitor to create.
workQueueThe queue that handles monitor operations.
notificationQueueThe queue to post status notifications to.
Return Value
A new instance of
SLRNetworkMonitorwith the specified configuration. -
Convenience initializer that creates a new instance of a
SLRNetworkMonitorof a specific type, work queue, & notification queue.Note
Use+monitorto get the default configuration.Declaration
Objective-C
+ (nonnull instancetype)monitorWithType:(SLRNetworkMonitorType)monitorType workQueue:(nullable dispatch_queue_t)workQueue notificationQueue: (nullable dispatch_queue_t)notificationQueue;Swift
convenience init(type monitorType: SLRNetworkMonitorType, work workQueue: DispatchQueue?, notificationQueue: DispatchQueue?)Parameters
monitorTypeThe type of monitor to create.
workQueueThe queue that handles monitor operations.
notificationQueueThe queue to post status notifications to.
Return Value
A new instance of
SLRNetworkMonitorwith the specified configuration. -
Convenience initializer that creates a new instance of a
SLRNetworkMonitorwith the default configuration.Declaration
Objective-C
+ (nonnull instancetype)monitor;Return Value
A new instance of
SLRNetworkMonitorwith the default configuration. -
Tells a
SLRNetworkMonitorto begin monitoring for network connectivity status changes.Declaration
Objective-C
- (void)startMonitoring;Swift
func startMonitoring() -
Tells a
SLRNetworkMonitorto stop monitoring for network connectivity status changes.Declaration
Objective-C
- (void)stopMonitoring;Swift
func stopMonitoring()
View on GitHub
SLRNetworkMonitor Class Reference