From d4e597eb94a90a816fcc480fa7b6719430a20b84 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Thu, 12 Apr 2018 18:59:09 -0400 Subject: [ios, macos] Convert various class methods to class properties This improves the Swift interface while having no effect on Obj-C usage. --- platform/ios/CHANGELOG.md | 1 + platform/ios/Mapbox.playground/Contents.swift | 2 +- platform/ios/docs/guides/Info.plist Keys.md | 2 +- .../scripts/script_resources/MapboxDemo/MapboxDemo/ViewController.swift | 2 +- platform/ios/src/MGLTelemetryConfig.h | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) (limited to 'platform/ios') diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 0d01d9a828..217c6b4b71 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -11,6 +11,7 @@ The 4.0._x_ series of releases will be the last to support iOS 8. The minimum iO * Removed support for 32-bit simulators. ([#10962](https://github.com/mapbox/mapbox-gl-native/pull/10962)) * Added Danish and Hebrew localizations. ([#10967](https://github.com/mapbox/mapbox-gl-native/pull/10967), [#11136](https://github.com/mapbox/mapbox-gl-native/pull/11134)) * Removed methods, properties, and constants that had been deprecated as of v3.7.6. ([#11205](https://github.com/mapbox/mapbox-gl-native/pull/11205), [#11681](https://github.com/mapbox/mapbox-gl-native/pull/11681)) +* Refined certain Swift interfaces by converting them from class methods to class properties. ([#11674](https://github.com/mapbox/mapbox-gl-native/pull/11674)) ### Styles diff --git a/platform/ios/Mapbox.playground/Contents.swift b/platform/ios/Mapbox.playground/Contents.swift index 04618d796e..f31c9b6171 100644 --- a/platform/ios/Mapbox.playground/Contents.swift +++ b/platform/ios/Mapbox.playground/Contents.swift @@ -51,7 +51,7 @@ panel.addSubview(pitchSwitch) Put your access token into a plain text file called `token`. Then select the “token” placeholder below, go to Editor ‣ Insert File Literal, and select the `token` file. */ var accessToken = try String(contentsOfURL: <#token#>) -MGLAccountManager.setAccessToken(accessToken) +MGLAccountManager.accessToken = accessToken class PlaygroundAnnotationView: MGLAnnotationView { diff --git a/platform/ios/docs/guides/Info.plist Keys.md b/platform/ios/docs/guides/Info.plist Keys.md index bc2f3f5786..cf00ec5499 100644 --- a/platform/ios/docs/guides/Info.plist Keys.md +++ b/platform/ios/docs/guides/Info.plist Keys.md @@ -8,7 +8,7 @@ Set the [Mapbox access token](https://www.mapbox.com/help/define-access-token/) Mapbox-hosted vector tiles and styles require an API access token, which you can obtain from the [Mapbox account page](https://www.mapbox.com/studio/account/tokens/). Access tokens associate requests to Mapbox’s vector tile and style APIs with your Mapbox account. They also deter other developers from using your styles without your permission. -As an alternative, you can use `+[MGLAccountManager setAccessToken:]` to set a token in code. See [our guide](https://www.mapbox.com/help/ios-private-access-token/) for some tips on keeping access tokens in open source code private. +As an alternative, you can use `MGLAccountManager.accessToken` to set a token in code. See [our guide](https://www.mapbox.com/help/ios-private-access-token/) for some tips on keeping access tokens in open source code private. ## MGLMapboxAPIBaseURL diff --git a/platform/ios/scripts/script_resources/MapboxDemo/MapboxDemo/ViewController.swift b/platform/ios/scripts/script_resources/MapboxDemo/MapboxDemo/ViewController.swift index 34bbcb7666..d28b4e7d73 100644 --- a/platform/ios/scripts/script_resources/MapboxDemo/MapboxDemo/ViewController.swift +++ b/platform/ios/scripts/script_resources/MapboxDemo/MapboxDemo/ViewController.swift @@ -110,7 +110,7 @@ class ViewController: UIViewController { // You can obtain your own access token from the // [Mapbox account page](https://www.mapbox.com/studio/account/tokens/) // and add it to this application's Info.plist as the value for MGLMapboxAccessToken - if MGLAccountManager.accessToken() == "pk.eyJ1IjoibWFwYm94IiwiYSI6ImNqYThuNnZ3NTA5MGMyd3F1cmF1eW1xaGEifQ.TdBTSHHPeT1pfLZ_6x_1vA" { + if MGLAccountManager.accessToken == "pk.eyJ1IjoibWFwYm94IiwiYSI6ImNqYThuNnZ3NTA5MGMyd3F1cmF1eW1xaGEifQ.TdBTSHHPeT1pfLZ_6x_1vA" { accessTokenWarningView.isHidden = false } diff --git a/platform/ios/src/MGLTelemetryConfig.h b/platform/ios/src/MGLTelemetryConfig.h index 527d344291..96e525c969 100644 --- a/platform/ios/src/MGLTelemetryConfig.h +++ b/platform/ios/src/MGLTelemetryConfig.h @@ -9,7 +9,7 @@ NS_ASSUME_NONNULL_BEGIN extern NSString *const MGLMapboxMetricsProfile; -+ (nullable instancetype)sharedConfig; +@property (class, nullable, nonatomic, readonly) MGLTelemetryConfig *sharedConfig; - (void)configurationFromKey:(NSString *)key; -- cgit v1.2.1