File tree Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change 1010
1111@interface ViewController () <MKMapViewDelegate>
1212
13- #pragma mark -
14- #pragma mark Variables
13+ #pragma mark - Variables
1514
1615@property (nonatomic ) MKMapView *mapView;
1716@property (nonatomic ) UILabel *resultsLabel;
@@ -24,13 +23,14 @@ @interface ViewController () <MKMapViewDelegate>
2423
2524@implementation ViewController
2625
27- #pragma mark -
28- #pragma mark Setup
26+ #pragma mark - Setup
2927
3028
3129- (void )viewDidLoad {
3230 [super viewDidLoad ];
3331
32+ NSAssert (![MapboxAccessToken isEqualToString: @" <# your Mapbox access token #>" ], @" You must set `MapboxAccessToken` to your Mapbox access token." );
33+
3434 self.mapView = [[MKMapView alloc ] initWithFrame: self .view.bounds];
3535 self.mapView .autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
3636 self.mapView .delegate = self;
@@ -47,8 +47,7 @@ - (void)viewDidLoad {
4747 self.geocoder = [[MBGeocoder alloc ] initWithAccessToken: MapboxAccessToken];
4848}
4949
50- #pragma mark -
51- #pragma mark MKMapViewDelegate
50+ #pragma mark - MKMapViewDelegate
5251
5352- (void )mapView : (MKMapView *)mapView regionWillChangeAnimated : (BOOL )animated {
5453 [self .geocoder cancelGeocode ];
Original file line number Diff line number Diff line change @@ -9,19 +9,19 @@ let MapboxAccessToken = "<# your Mapbox access token #>"
99
1010class ViewController : UIViewController , MKMapViewDelegate {
1111
12- // MARK: -
13- // MARK: Variables
12+ // MARK: - Variables
1413
1514 var mapView : MKMapView !
1615 var resultsLabel : UILabel !
1716// var geocoder: CLGeocoder!
1817 var geocoder : MBGeocoder !
1918
20- // MARK: -
21- // MARK: Setup
19+ // MARK: - Setup
2220
2321 override func viewDidLoad( ) {
2422 super. viewDidLoad ( )
23+
24+ assert ( MapboxAccessToken != " <# your Mapbox access token #> " , " You must set `MapboxAccessToken` to your Mapbox access token. " )
2525
2626 mapView = MKMapView ( frame: view. bounds)
2727 mapView. autoresizingMask = [ . FlexibleWidth, . FlexibleHeight ]
@@ -39,8 +39,7 @@ class ViewController: UIViewController, MKMapViewDelegate {
3939 geocoder = MBGeocoder ( accessToken: MapboxAccessToken)
4040 }
4141
42- // MARK: -
43- // MARK: MKMapViewDelegate
42+ // MARK: - MKMapViewDelegate
4443
4544 func mapView( mapView: MKMapView , regionWillChangeAnimated animated: Bool ) {
4645 geocoder. cancelGeocode ( )
You can’t perform that action at this time.
0 commit comments