NXNetwork
@interface NXNetwork : NSObject
NXNetwork is a long-use object used to listen to and handle changes in a device’s network reachability. You should create an instance of a NXNetwork object and retain a strong reference to it in memory, and react to changes using by observing the NXNetworkReachabilityStatusChanged
notification, a block you can assign to nexum instance’s reachabilityStatusChangedHandler
property, or an object that conforms to NXNetworkDelegate
protocol.
-
The generic shared network object. You can use this singleton if you don’t want to manage ownership of the network object directly, and you can interact with and observe changes to its reachabilty status via notifications, blocks, its delegate object.
Declaration
Objective-C
+ (nullable instancetype)sharedNetwork;
Return Value
The shared network object
-
Create a generic network object, observing changes to internet reachability
Declaration
Objective-C
+ (nullable instancetype)network;
Return Value
The network object
-
Create network object that observes changes to the reachability of a single hostname and only that hostname
Declaration
Objective-C
- (nullable instancetype)initWithHostName:(nonnull NSString *)hostName;
Parameters
hostName
The host name
Return Value
The network object.
-
Create network object that observes changes to the reachability of a single IP address and only that IP address
Declaration
Objective-C
- (nullable instancetype)initWithHostAddress: (nonnull const struct sockaddr *)hostAddress;
Parameters
hostAddress
The IP address
Return Value
The network object
-
Create a network object that observes changes to the reachability of an IP Address pair
Declaration
Parameters
localAddress
The local IP address
remoteAddress
The remote IP address
Return Value
The network object
-
The delegate object to be informed of changes to the network object’s reachability status
Declaration
Objective-C
@property (readwrite, atomic, nullable) id<NXNetworkDelegate> delegate;
-
The block to be executed when the network object’s reachability status changes
Declaration
Objective-C
@property (readwrite, copy, nonatomic, nullable) NXNetworkReachabilityStatusChangedHandler reachabilityStatusChangedHandler;
-
Begin listening to changes in reachability
Declaration
Objective-C
- (BOOL)startListening;
Return Value
YES if network object began listening, otherwise NO.
-
Stop listening to changes in reachability
Declaration
Objective-C
- (void)stopListening;
-
The current reachability status of the network object
Declaration
Objective-C
@property (readonly, nonatomic) NXNetworkReachabilityStatus reachabilityStatus;
-
YES if the device is reachable, otherwise NO.
Declaration
Objective-C
@property (readonly, getter=isReachable, nonatomic) BOOL reachable;
-
YES if connection is required, otherwise NO.
Declaration
Objective-C
@property (readonly, getter=isConnectionRequired, nonatomic) BOOL connectionRequired;
-
YES if connection is on demand, otherwise NO.
Declaration
Objective-C
@property (readonly, getter=isOnDemand, nonatomic) BOOL onDemand;
-
YES if intervention is required, otherwise NO.
Declaration
Objective-C
@property (readonly, getter=isInterventionRequired, nonatomic) BOOL interventionRequired;