-
-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate some hardcoded mapbox styles, and replace those that remain with maplibre styles. (+docs!) #45
Deprecate some hardcoded mapbox styles, and replace those that remain with maplibre styles. (+docs!) #45
Changes from all commits
908f1a7
9c5b637
8ff89c1
7d907bf
708832e
44f15c2
37e69c6
945ddee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,8 +50,8 @@ class CarPlayMapViewController: UIViewController, MLNMapViewDelegate { | |
super.viewDidLoad() | ||
|
||
self.styleManager = StyleManager(self) | ||
self.styleManager.styles = [DayStyle(), NightStyle()] | ||
self.styleManager.styles = [DayStyle(demoStyle: ()), NightStyle(demoStyle: ())] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The demo styles are now being used in some places that were previously defaulting to mapbox styles. This is probably wrong, but (I think) no worse than things being completely broken before. Probably these should somehow be surfaced or inferred as well. I somewhat arbitrarily decided this was out of scope for this PR, but I could follow up in this PR or another depending on how people are feeling about it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I personally don't mind your approach here 👍 |
||
|
||
self.resetCamera(animated: false, altitude: CarPlayMapViewController.defaultAltitude) | ||
self.mapView.setUserTrackingMode(.followWithCourse, animated: true, completionHandler: nil) | ||
} | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,28 +34,52 @@ open class Style: NSObject { | |
/** | ||
URL of the style to display on the map during turn-by-turn navigation. | ||
*/ | ||
@objc open var mapStyleURL: URL = MLNStyle.navigationGuidanceDayStyleURL | ||
@objc open var mapStyleURL: URL = MLNStyle.defaultStyle().url | ||
|
||
#if canImport(CarPlay) | ||
/** | ||
URL of the style to display on the map when previewing a route, for example on CarPlay. | ||
*/ | ||
@objc open var previewMapStyleURL = MLNStyle.navigationPreviewDayStyleURL | ||
@objc open var previewMapStyleURL = MLNStyle.defaultStyle().url | ||
#else | ||
/** | ||
URL of the style to display on the map when previewing a route. | ||
|
||
This property is currently unused by default, but you can use it to present your own route preview map. | ||
*/ | ||
@objc open var previewMapStyleURL = MLNStyle.navigationPreviewDayStyleURL | ||
@objc open var previewMapStyleURL = MLNStyle.defaultStyle().url | ||
#endif | ||
|
||
/** | ||
Applies the style for all changed properties. | ||
*/ | ||
@objc open func apply() {} | ||
|
||
@objc override public required init() {} | ||
|
||
@available(*, deprecated, message: "Use `init(mapStyleURL:)` to specify your map style. If you want to try the demo maplibre tiles, use init(demoStyle: ()).") | ||
@objc override public convenience init() { | ||
self.init(demoStyle: ()) | ||
} | ||
|
||
@objc public required init(mapStyleURL: URL) { | ||
self.mapStyleURL = mapStyleURL | ||
} | ||
|
||
@objc public convenience init(demoStyle: ()) { | ||
self.init(mapStyleURL: MLNStyle.defaultStyle().url) | ||
} | ||
} | ||
|
||
extension Style: NSCopying { | ||
public func copy(with zone: NSZone? = nil) -> Any { | ||
let copy = Self(mapStyleURL: self.mapStyleURL) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Living in Swift land for a while, I forgot about NSCopying! |
||
copy.tintColor = self.tintColor | ||
copy.statusBarStyle = self.statusBarStyle | ||
copy.fontFamily = self.fontFamily | ||
copy.styleType = self.styleType | ||
copy.mapStyleURL = self.mapStyleURL | ||
copy.previewMapStyleURL = self.previewMapStyleURL | ||
return copy | ||
} | ||
} | ||
|
||
/** | ||
|
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.
Technically breaking from an API standpoint, though it seems like it would not have been working for anyone before.
Alternatively, we could keep the old methods around, deprecate them, and have them all return
DayStyle(demoStyle: ())
or something?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.
Breaking is fine for me 👍