Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Boxing ObjC structs #9343

Merged
merged 2 commits into from
Jun 22, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions platform/darwin/src/MGLGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -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`. */
Expand Down Expand Up @@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion platform/darwin/src/MGLLight.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion platform/darwin/src/MGLOfflinePack.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion platform/darwin/src/MGLTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
6 changes: 3 additions & 3 deletions platform/darwin/test/MGLLightTest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ - (void)testProperties {
- (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);
}
Expand Down