daily pastebin goal
50%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #import "ViewController.h"
  2. #import <Network/Network.h>
  3.  
  4. @interface ViewController ()
  5. @property (strong,nonatomic) nw_path_monitor_t pathMonitor;
  6. @end
  7.  
  8. @implementation ViewController
  9.  
  10.  
  11. - (void)viewDidLoad {
  12.     [super viewDidLoad];
  13.     // Do any additional setup after loading the view, typically from a nib.
  14.    
  15.     self.pathMonitor = nw_path_monitor_create();
  16.     nw_path_monitor_set_update_handler(self.pathMonitor, ^(nw_path_t  _Nonnull path) {
  17.         NSLog(@"Network path changed");
  18.         bool isExpensive = nw_path_is_expensive(path);
  19.         NSLog(@"Path is expensive - %d",isExpensive);
  20.     });
  21.     nw_path_monitor_start(self.pathMonitor);
  22. }
  23.  
  24.  
  25. @end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top