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

[ios, macos] Remove duplicated variables in MGLMapSnapshotter #10702

Merged
merged 1 commit into from
Dec 20, 2017

Conversation

fabian-guerra
Copy link
Contributor

Fixes #10435

@fabian-guerra fabian-guerra self-assigned this Dec 14, 2017
property is non-nil, the camera’s altitude is ignored in favor of this
property’s value.
*/
@property (nonatomic) double zoomLevel;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this public symbol would technically be a backwards-incompatible change. On the other hand, these properties are have no effect and are never set, so I guess we can assume no one is using them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was released since 3.7.0 I think it's use is not spread. Since this is backwards-incompatible we may want to release it as part of 4.0 and not in a patch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds reasonable to me. Alternatively, if a patch release is going out the door anyways, we can mark these methods as deprecated for now and remove them when v4.0.0 comes out.

}
return self;
}

- (void)initMBGLMapSnapshotter:(MGLMapSnapshotOptions *)options
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we go with a different method name here? Style-wise, I'm not a fan of leading method names with init if they're not a proper initializer (and I believe it breaks convention, although I'm in too much of a hurry to dig up a citation)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-configureMapSnapshotterWithOptions: perhaps? or -setUpMapSnapshotterWithOptions:

Copy link
Contributor

@1ec5 1ec5 Dec 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Beginning a non-initializer with init is problematic because ARC expects to retain its return value. There’s a memorable slide from WWDC11 about a hypothetical -copyMachine method that has to be renamed -copymachine for the same reason. 😬

@kkaefer kkaefer added iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS labels Dec 18, 2017
@fabian-guerra fabian-guerra force-pushed the fabian-ss-redundant-10435 branch from 950badf to 372da68 Compare December 18, 2017 17:34

// Create the snapshotter
_mbglMapSnapshotter = std::make_unique<mbgl::MapSnapshotter>(*mbglFileSource, *_mbglThreadPool, styleURL, size, pixelRatio, cameraOptions, coordinateBounds);
[self configureMBGLMapSnapshotter:options];
Copy link
Contributor

@1ec5 1ec5 Dec 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both call sites to -configureMBGLMapSnapshotter: pass in the value of the options property. Since it isn’t necessary to support configuring the receiver based on an arbitrary options object, let’s remove this parameter and have -configureMBGLMapSnapshotter refer to the options property.

The usual name for a method like this is -commonInit, as seen in MGLMapView. However, this method is also called from a non-initializer, so it would be slightly misleading to name it that.

Since the intention is to update the snapshotter object whenever the options object is set, including when it is set for the first time, how about folding this method into -setOptions: and having the initializer call -setOptions:?

@fabian-guerra fabian-guerra force-pushed the fabian-ss-redundant-10435 branch from 372da68 to f6184d8 Compare December 19, 2017 20:47
@fabian-guerra fabian-guerra merged commit f644d18 into release-agua Dec 20, 2017
@fabian-guerra fabian-guerra deleted the fabian-ss-redundant-10435 branch December 20, 2017 15:01
@friedbunny friedbunny added this to the ios-v3.7.2 milestone Dec 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants