diff options
author | Fabian Guerra Soto <fabian.guerra@mapbox.com> | 2017-06-22 14:36:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-22 14:36:21 -0400 |
commit | a1c5b32da66a32e52e24163f826dabbc1e4d38bf (patch) | |
tree | 77ff10c12884788022523ea6ad0d23e94d63bdf4 /platform | |
parent | b7ec96d352c78172b6df4afedd6fc0e7db142a54 (diff) | |
download | qtlocation-mapboxgl-a1c5b32da66a32e52e24163f826dabbc1e4d38bf.tar.gz |
Boxing ObjC structs (#9343)
* [ios, macos] Make structs boxable
* [ios, macos] Update changelogs.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/darwin/src/MGLGeometry.h | 4 | ||||
-rw-r--r-- | platform/darwin/src/MGLLight.h | 2 | ||||
-rw-r--r-- | platform/darwin/src/MGLOfflinePack.h | 2 | ||||
-rw-r--r-- | platform/darwin/src/MGLTypes.h | 2 | ||||
-rw-r--r-- | platform/darwin/test/MGLLightTest.mm | 6 | ||||
-rw-r--r-- | platform/ios/CHANGELOG.md | 1 | ||||
-rw-r--r-- | platform/macos/CHANGELOG.md | 1 |
7 files changed, 10 insertions, 8 deletions
diff --git a/platform/darwin/src/MGLGeometry.h b/platform/darwin/src/MGLGeometry.h index 9fcb9dd37c..d37741cde5 100644 --- a/platform/darwin/src/MGLGeometry.h +++ b/platform/darwin/src/MGLGeometry.h @@ -7,7 +7,7 @@ NS_ASSUME_NONNULL_BEGIN /** Defines the area spanned by an `MGLCoordinateBounds`. */ -typedef struct MGLCoordinateSpan { +typedef struct __attribute__((objc_boxable)) MGLCoordinateSpan { /** Latitudes spanned by an `MGLCoordinateBounds`. */ CLLocationDegrees latitudeDelta; /** Longitudes spanned by an `MGLCoordinateBounds`. */ @@ -38,7 +38,7 @@ NS_INLINE BOOL MGLCoordinateSpanEqualToCoordinateSpan(MGLCoordinateSpan span1, M extern MGL_EXPORT const MGLCoordinateSpan MGLCoordinateSpanZero; /** A rectangular area as measured on a two-dimensional map projection. */ -typedef struct MGLCoordinateBounds { +typedef struct __attribute__((objc_boxable)) MGLCoordinateBounds { /** Coordinate at the southwest corner. */ CLLocationCoordinate2D sw; /** Coordinate at the northeast corner. */ diff --git a/platform/darwin/src/MGLLight.h b/platform/darwin/src/MGLLight.h index 55b789f043..50db3f45fd 100644 --- a/platform/darwin/src/MGLLight.h +++ b/platform/darwin/src/MGLLight.h @@ -27,7 +27,7 @@ typedef NS_ENUM(NSUInteger, MGLLightAnchor) { A structure containing information about the position of the light source relative to lit geometries. */ -typedef struct MGLSphericalPosition { +typedef struct __attribute__((objc_boxable)) MGLSphericalPosition { /** Distance from the center of the base of an object to its light. */ CGFloat radial; /** Position of the light relative to 0° (0° when `MGLLight.anchor` is set to viewport corresponds diff --git a/platform/darwin/src/MGLOfflinePack.h b/platform/darwin/src/MGLOfflinePack.h index 0b2db35b1a..dfc47bf1c8 100644 --- a/platform/darwin/src/MGLOfflinePack.h +++ b/platform/darwin/src/MGLOfflinePack.h @@ -54,7 +54,7 @@ typedef NS_ENUM (NSInteger, MGLOfflinePackState) { A structure containing information about an offline pack’s current download progress. */ -typedef struct MGLOfflinePackProgress { +typedef struct __attribute__((objc_boxable)) MGLOfflinePackProgress { /** The number of resources, including tiles, that have been completely downloaded and are ready to use offline. diff --git a/platform/darwin/src/MGLTypes.h b/platform/darwin/src/MGLTypes.h index 16f510b5a6..b3227e1cdf 100644 --- a/platform/darwin/src/MGLTypes.h +++ b/platform/darwin/src/MGLTypes.h @@ -78,7 +78,7 @@ typedef NS_OPTIONS(NSUInteger, MGLMapDebugMaskOptions) { /** A structure containing information about a transition. */ -typedef struct MGLTransition { +typedef struct __attribute__((objc_boxable)) MGLTransition { /** The amount of time the animation should take, not including the delay. */ diff --git a/platform/darwin/test/MGLLightTest.mm b/platform/darwin/test/MGLLightTest.mm index b021bd1b73..8f901cbb72 100644 --- a/platform/darwin/test/MGLLightTest.mm +++ b/platform/darwin/test/MGLLightTest.mm @@ -132,9 +132,9 @@ - (void)testValueAdditions { MGLSphericalPosition position = MGLSphericalPositionMake(1.15, 210, 30); - XCTAssertEqual([NSValue valueWithMGLSphericalPosition:position].MGLSphericalPositionValue.radial, position.radial); - XCTAssertEqual([NSValue valueWithMGLSphericalPosition:position].MGLSphericalPositionValue.azimuthal, position.azimuthal); - XCTAssertEqual([NSValue valueWithMGLSphericalPosition:position].MGLSphericalPositionValue.polar, position.polar); + XCTAssertEqual(@(position).MGLSphericalPositionValue.radial, position.radial); + XCTAssertEqual(@(position).MGLSphericalPositionValue.azimuthal, position.azimuthal); + XCTAssertEqual(@(position).MGLSphericalPositionValue.polar, position.polar); XCTAssertEqual([NSValue valueWithMGLLightAnchor:MGLLightAnchorMap].MGLLightAnchorValue, MGLLightAnchorMap); XCTAssertEqual([NSValue valueWithMGLLightAnchor:MGLLightAnchorViewport].MGLLightAnchorValue, MGLLightAnchorViewport); } diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 351876215a..2a85186765 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -52,6 +52,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * The error passed into `-[MGLMapViewDelegate mapViewDidFailLoadingMap:withError:]` now includes a more specific description and failure reason. ([#8418](https://github.com/mapbox/mapbox-gl-native/pull/8418)) * Improved CPU and battery performance while animating a tilted map’s camera in an area with many labels. ([#9031](https://github.com/mapbox/mapbox-gl-native/pull/9031)) * Fixed an issue rendering polylines that contain duplicate vertices. ([#8808](https://github.com/mapbox/mapbox-gl-native/pull/8808)) +* Added struct boxing to `MGLCoordinateSpan`, `MGLCoordinateBounds`, `MGLOfflinePackProgress`, and `MGLTransition`. ([#9343](https://github.com/mapbox/mapbox-gl-native/pull/9343) ## 3.5.4 - May 9, 2017 diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 5afdd32180..fa912125ec 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -33,6 +33,7 @@ * The `MGLPolyline.coordinate` and `MGLPolygon.coordinate` properties now return the midpoint and centroid, respectively, instead of the first coordinate. ([#8713](https://github.com/mapbox/mapbox-gl-native/pull/8713)) * Improved CPU and battery performance while animating a tilted map’s camera in an area with many labels. ([#9031](https://github.com/mapbox/mapbox-gl-native/pull/9031)) * Fixed an issue rendering polylines that contain duplicate vertices. ([#8808](https://github.com/mapbox/mapbox-gl-native/pull/8808)) +* Added struct boxing to `MGLCoordinateSpan`, `MGLCoordinateBounds`, `MGLOfflinePackProgress`, and `MGLTransition`. ([#9343](https://github.com/mapbox/mapbox-gl-native/pull/9343) ## 0.4.1 - April 8, 2017 |