Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import "ViewController.h"
- #import <Network/Network.h>
- @interface ViewController ()
- @property (strong,nonatomic) nw_path_monitor_t pathMonitor;
- @end
- @implementation ViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view, typically from a nib.
- self.pathMonitor = nw_path_monitor_create();
- nw_path_monitor_set_update_handler(self.pathMonitor, ^(nw_path_t _Nonnull path) {
- NSLog(@"Network path changed");
- bool isExpensive = nw_path_is_expensive(path);
- NSLog(@"Path is expensive - %d",isExpensive);
- });
- nw_path_monitor_start(self.pathMonitor);
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement