-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ios, macos] Convert various class methods to class properties #11674
Conversation
@@ -3,7 +3,7 @@ | |||
@interface MGLAccountManager (Private) | |||
|
|||
/// Returns the shared instance of the `MGLAccountManager` class. | |||
+ (instancetype)sharedManager; | |||
@property (class, nonatomic, readonly) MGLAccountManager *sharedManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of nonatomic
for these class properties is consistent with previous behavior when these properties were class methods. atomic
is a remnant of cargo-cult programming that resulted in excessive locking and dispatching early on.
platform/ios/CHANGELOG.md
Outdated
@@ -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.4. ([#11205](https://github.com/mapbox/mapbox-gl-native/pull/11205)) | |||
* Refined certain Swift interfaces by converting them from class methods to class properties. ([#11674](https://github.com/mapbox/mapbox-gl-native/pull/11674)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the same blurb to the macOS changelog. Thanks!
Some auxiliary content to update:
|
This is ready for review. 🙋♂️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
This improves the Swift interface while having no effect on Obj-C usage.
24d13e1
to
d4e597e
Compare
Fixes #6778. This improves our Swift interface in an unavoidably breaking way while mostly having no effect on Obj-C usage.
For example, before → after:
MGLStyle.streetsStyleURL()
→MGLStyle.streetsStyleURL
MGLOfflineStorage.shared()
→MGLOfflineStorage.shared
MGLAccountManager.setAccessToken("foo")
→MGLAccountManager.accessToken = "foo”
This also updates a variety of internal/undocumented classes in a similar way — this doesn’t really matter while we’re using Obj-C, but future-proofs potential Swiftification.
To-do (suggestions welcome)
Improve changelog entry.nonatomic
?/cc @mapbox/maps-ios