Skip to content

Commit 9cbbd2f

Browse files
authored
Merge pull request #2230 from mapbox/jerrad/objc-delenda-est
1.0 Objective-C Obsoletion
2 parents 420b287 + 2a1ac22 commit 9cbbd2f

File tree

206 files changed

+2177
-2518
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+2177
-2518
lines changed

Bench/AppDelegate.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@ import UIKit
22

33
@UIApplicationMain
44
class AppDelegate: UIResponder, UIApplicationDelegate {
5-
65
var window: UIWindow?
76

8-
97
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
10-
118
window = UIWindow(frame: UIScreen.main.bounds)
129

1310
if isRunningTests() {

Bench/BenchViewController.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ struct Item {
2626
}
2727

2828
class BenchViewController: UITableViewController {
29-
3029
var dataSource = [Section]()
3130
let cellIdentifier = "cellId"
3231

3332
override func viewDidLoad() {
34-
3533
super.viewDidLoad()
3634

3735
tableView.register(UITableViewCell.self, forCellReuseIdentifier: cellIdentifier)
@@ -66,7 +64,6 @@ class BenchViewController: UITableViewController {
6664
}
6765

6866
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
69-
7067
let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath)
7168
let item = dataSource[indexPath.section].items[indexPath.row]
7269

@@ -76,7 +73,6 @@ class BenchViewController: UITableViewController {
7673
}
7774

7875
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
79-
8076
tableView.deselectRow(at: indexPath, animated: true)
8177

8278
let item = dataSource[indexPath.section].items[indexPath.row]
@@ -90,7 +86,6 @@ class BenchViewController: UITableViewController {
9086
}
9187

9288
extension BenchViewController: NavigationViewControllerDelegate {
93-
9489
func navigationViewControllerDidDismiss(_ navigationViewController: NavigationViewController, byCanceling canceled: Bool) {
9590
navigationController?.popViewController(animated: true)
9691
}

Bench/ControlRouteViewController.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import UIKit
22
import MapboxNavigation
33

4-
54
class ControlRouteViewController: NavigationViewController {
6-
75
override func viewWillAppear(_ animated: Bool) {
86
super.viewWillAppear(animated)
97

BenchTests/BenchTests.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import MapboxDirections
55
@testable import MapboxNavigation
66
@testable import Bench
77

8-
98
class BenchTests: XCTestCase, CLLocationManagerDelegate {
10-
119
let token = "deadbeef"
1210

1311
override func setUp() {
@@ -16,7 +14,6 @@ class BenchTests: XCTestCase, CLLocationManagerDelegate {
1614
}
1715

1816
func testControlRoute1() {
19-
2017
let route = Fixture.route(from: "PipeFittersUnion-FourSeasonsBoston")
2118
let trace = Fixture.locations(from: "PipeFittersUnion-FourSeasonsBoston.trace")
2219

@@ -33,7 +30,6 @@ class BenchTests: XCTestCase, CLLocationManagerDelegate {
3330
}
3431

3532
func testControlRoute2() {
36-
3733
let route = Fixture.route(from: "DCA-Arboretum")
3834
let trace = Fixture.locations(from: "DCA-Arboretum.trace")
3935

@@ -50,7 +46,6 @@ class BenchTests: XCTestCase, CLLocationManagerDelegate {
5046
}
5147

5248
func navigationViewController(route: Route, locationManager: ReplayLocationManager) -> NavigationViewController {
53-
5449
let speechAPI = SpeechAPISpy(accessToken: token)
5550
let directions = DirectionsSpy(accessToken: token)
5651
let service = MapboxNavigationService(route: route,
@@ -66,5 +61,3 @@ class BenchTests: XCTestCase, CLLocationManagerDelegate {
6661
return NavigationViewController(for: route, options: options)
6762
}
6863
}
69-
70-

BenchUITests/BenchUITests.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import XCTest
22

33
class BenchUITests: XCTestCase {
4-
54
override func setUp() {
65
continueAfterFailure = false
76
XCUIApplication().launch()
87
}
98

109
func testExample() {
11-
1210
}
1311
}

CHANGELOG.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,22 @@
22

33
## master
44

5+
### Packaging
6+
* This library can no longer be used in applications written in pure Objective-C. If you need to use this library’s public API from Objective-C code, you will need to implement a wrapper in Swift that bridges the subset of the API you need from Swift to Objective-C. ([#2230](https://github.com/mapbox/mapbox-navigation-ios/pull/2230))
7+
8+
### User interface
9+
* `UserCourseView` is now a type alias of the `UIView` class and the `CourseUpdatable` protocol rather than a protocol in its own right. ([#2230](https://github.com/mapbox/mapbox-navigation-ios/pull/2230))
510
* Fixed an issue where user notifications displayed right turn arrows for left turn maneuvers. ([#2270](https://github.com/mapbox/mapbox-navigation-ios/pull/2270))
11+
* Renamed `NavigationMapView.showRoutes(_:legIndex:)` to `NavigationMapView.show(_:legIndex:)`. ([#2230](https://github.com/mapbox/mapbox-navigation-ios/pull/2230))
12+
* Renamed `NavigationMapView.showWaypoints(_:legIndex:)` to `NavigationMapView.showWaypoints(on:legIndex:)`. ([#2230](https://github.com/mapbox/mapbox-navigation-ios/pull/2230))
13+
* Renamed `MapboxVoiceController.play(_:)` to `MapboxVoiceController.play(instruction:data:)`. ([#2230](https://github.com/mapbox/mapbox-navigation-ios/pull/2230))
14+
15+
### Error handling
16+
* The `MapboxVoiceController` and `RouteVoiceController` now emit `SpeechError`s instead of an `NSError` object. ([#2230](https://github.com/mapbox/mapbox-navigation-ios/pull/2230))
17+
* Added the `VoiceControllerDelegate.voiceController(_:didFallBackTo:becauseOf:)` method for detecting when the voice controller falls back to `AVSpeechSynthesizer`. ([#2230](https://github.com/mapbox/mapbox-navigation-ios/pull/2230))
18+
19+
### Other changes
20+
* Since pure Swift protocols cannot have optional methods, various delegate protocols now provide default no-op implementations for all their methods and conform to the `UnimplementedLogging` protocol, which can inform you at runtime when a delegate method is called but has not been implemented. Messages are sent through Apple Unified Logging and can be disabled globally through [Unifed Logging](https://developer.apple.com/documentation/os/logging#2878594), or by overriding the delegate function with a no-op implementation. ([#2230](https://github.com/mapbox/mapbox-navigation-ios/pull/2230))
621

722
## v0.38.0
823

@@ -146,7 +161,6 @@
146161
* You can now customize the control layer of the map template comprising of the navigation bar's leading and trailing buttons and the map buttons. ([#1962](https://github.com/mapbox/mapbox-navigation-ios/pull/1962))
147162
* Added new map buttons in the `CarPlayManager` and the `CarPlayMapViewController`. You can now access map buttons that perform built-in actions on the map by accessing read-only properties such as: `CarPlayManager.exitButton`, `CarPlayManager.muteButton`, `CarPlayManager.showFeedbackButton`, `CarPlayManager.overviewButton`, `CarPlayMapViewController.recenterButton`, `CarPlayMapViewController.zoomInButton`, `CarPlayMapViewController.zoomOutButton`, `CarPlayMapViewController.panningInterfaceDisplayButton(for:)`, `CarPlayMapViewController.panningInterfaceDismissalButton(for:)`. ([#1962](https://github.com/mapbox/mapbox-navigation-ios/pull/1962))
148163

149-
150164
### Other changes
151165

152166
* Replaced `NavigationViewController(for:styles:navigationService:viewController:)` with `NavigationViewController(for:options:)`, which accepts a `NavigationOptions` object (not to be confused with `NavigationRouteOptions`). `NavigationOptions` contains various options for customizing the user experience of a turn-by-turn navigation session, including replacing the bottom banner with a custom view controller. ([#1951](https://github.com/mapbox/mapbox-navigation-ios/pull/1951))
@@ -630,7 +644,6 @@
630644

631645
* Exposes `RouteVoiceController.speak(_:)` which would allow custom subclass of MapboxVoiceController to override this method and pass a modified SpokenInstruction to our superclass implementation.
632646

633-
634647
## v0.13.1 (February 7, 2018)
635648

636649
### Core Navigation

Cartfile.resolved

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" "5.2.0"
1+
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" "5.5.0"
22
binary "https://www.mapbox.com/ios-sdk/MapboxNavigationNative.json" "6.2.1"
33
github "AndriiDoroshko/SnappyShrimp" "1.6.4"
44
github "CedarBDD/Cedar" "v1.0"
5-
github "Quick/Nimble" "v8.0.2"
6-
github "Quick/Quick" "v2.1.0"
5+
github "Quick/Nimble" "v8.0.4"
6+
github "Quick/Quick" "v2.2.0"
77
github "ceeK/Solar" "2.1.0"
88
github "mapbox/MapboxDirections.swift" "v0.30.0"
99
github "mapbox/MapboxGeocoder.swift" "v0.10.2"

Example/AppDelegate+CarPlay.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ let CarPlayWaypointKey: String = "MBCarPlayWaypoint"
1919
*/
2020
@available(iOS 12.0, *)
2121
extension AppDelegate: CPApplicationDelegate {
22-
2322
// MARK: CPApplicationDelegate
2423

2524
func application(_ application: UIApplication, didConnectCarInterfaceController interfaceController: CPInterfaceController, to window: CPWindow) {
@@ -46,15 +45,13 @@ extension AppDelegate: CPApplicationDelegate {
4645
@available(iOS 12.0, *)
4746
extension AppDelegate: CarPlayManagerDelegate {
4847
func carPlayManager(_ carPlayManager: CarPlayManager, navigationServiceAlong route: Route, desiredSimulationMode: SimulationMode) -> NavigationService {
49-
5048
if let nvc = self.window?.rootViewController?.presentedViewController as? NavigationViewController, let service = nvc.navigationService {
5149
//Do not set simulation mode if we already have an active navigation session.
5250
return service
5351
}
5452
return MapboxNavigationService(route: route, simulating: desiredSimulationMode)
5553
}
5654

57-
5855
// MARK: CarPlayManagerDelegate
5956
func carPlayManager(_ carPlayManager: CarPlayManager, didBeginNavigationWith service: NavigationService) {
6057
currentAppRootViewController?.beginNavigationWithCarplay(navigationService: service)
@@ -78,7 +75,6 @@ extension AppDelegate: CarPlayManagerDelegate {
7875
}
7976

8077
func carPlayManager(_ carPlayManager: CarPlayManager, leadingNavigationBarButtonsCompatibleWith traitCollection: UITraitCollection, in template: CPTemplate, for activity: CarPlayActivity) -> [CPBarButton]? {
81-
8278
guard let interfaceController = self.carPlayManager.interfaceController else {
8379
return nil
8480
}
@@ -107,7 +103,6 @@ extension AppDelegate: CarPlayManagerDelegate {
107103
}
108104

109105
func carPlayManager(_ carPlayManager: CarPlayManager, trailingNavigationBarButtonsCompatibleWith traitCollection: UITraitCollection, in template: CPTemplate, for activity: CarPlayActivity) -> [CPBarButton]? {
110-
111106
switch activity {
112107
case .previewing:
113108
let disableSimulateText = "Disable Simulation"
@@ -133,11 +128,10 @@ extension AppDelegate: CarPlayManagerDelegate {
133128
}
134129

135130
func carPlayManager(_ carPlayManager: CarPlayManager, mapButtonsCompatibleWith traitCollection: UITraitCollection, in template: CPTemplate, for activity: CarPlayActivity) -> [CPMapButton]? {
136-
137131
switch activity {
138132
case .browsing:
139133
guard let mapViewController = carPlayManager.carPlayMapViewController,
140-
let mapTemplate = template as? CPMapTemplate else {
134+
let mapTemplate = template as? CPMapTemplate else {
141135
return nil
142136
}
143137
var mapButtons = [mapViewController.recenterButton,
@@ -175,7 +169,6 @@ extension AppDelegate: CarPlaySearchControllerDelegate {
175169

176170
@available(iOS 12.0, *)
177171
extension AppDelegate: CPListTemplateDelegate {
178-
179172
func listTemplate(_ listTemplate: CPListTemplate, didSelect item: CPListItem, completionHandler: @escaping () -> Void) {
180173
// Selected a favorite
181174
if let userInfo = item.userInfo as? [String: Any],

Example/AppDelegate.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import UIKit
22
import MapboxNavigation
33

4-
54
@UIApplicationMain
65
class AppDelegate: UIResponder, UIApplicationDelegate {
7-
86
weak var currentAppRootViewController: ViewController?
97

108
var window: UIWindow?
@@ -15,7 +13,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1513
lazy var carPlaySearchController: CarPlaySearchController = CarPlaySearchController()
1614

1715
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
18-
1916
if isRunningTests() {
2017
window!.rootViewController = UIViewController()
2118
}

Example/CustomStyles.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import Foundation
22
import MapboxNavigation
33

4+
// MARK: CustomDayStyle
5+
46
/**
57
To find more pieces of the UI to customize, checkout DayStyle.swift.
68
*/
7-
// MARK: CustomDayStyle
89
class CustomDayStyle: DayStyle {
9-
1010
required init() {
1111
super.init()
1212
mapStyleURL = URL(string: "mapbox://styles/mapbox/satellite-streets-v9")!
@@ -22,7 +22,6 @@ class CustomDayStyle: DayStyle {
2222

2323
// MARK: CustomNightStyle
2424
class CustomNightStyle: NightStyle {
25-
2625
required init() {
2726
super.init()
2827
mapStyleURL = URL(string: "mapbox://styles/mapbox/satellite-streets-v9")!

Example/CustomViewController.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import MapboxDirections
88
import Turf
99

1010
class CustomViewController: UIViewController, MGLMapViewDelegate {
11-
1211
var destination: MGLPointAnnotation!
1312
let directions = Directions.shared
1413
var navigationService: NavigationService!
@@ -81,7 +80,7 @@ class CustomViewController: UIViewController, MGLMapViewDelegate {
8180
}
8281

8382
func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {
84-
self.mapView.showRoutes([navigationService.route])
83+
self.mapView.show([navigationService.route])
8584
}
8685

8786
// Notifications sent on all location updates
@@ -115,7 +114,7 @@ class CustomViewController: UIViewController, MGLMapViewDelegate {
115114
// Fired when the user is no longer on the route.
116115
// Update the route on the map.
117116
@objc func rerouted(_ notification: NSNotification) {
118-
self.mapView.showRoutes([navigationService.route])
117+
self.mapView.show([navigationService.route])
119118
}
120119

121120
@IBAction func cancelButtonPressed(_ sender: Any) {
@@ -161,9 +160,9 @@ class CustomViewController: UIViewController, MGLMapViewDelegate {
161160
let route = navigationService.route
162161

163162
// find the leg that contains the step, legIndex, and stepIndex
164-
guard let leg = route.legs.first(where: { $0.steps.contains(step) }),
165-
let legIndex = route.legs.firstIndex(of: leg),
166-
let stepIndex = leg.steps.firstIndex(of: step) else {
163+
guard let leg = route.legs.first(where: { $0.steps.contains(step) }),
164+
let legIndex = route.legs.firstIndex(of: leg),
165+
let stepIndex = leg.steps.firstIndex(of: step) else {
167166
return
168167
}
169168

@@ -207,7 +206,7 @@ class CustomViewController: UIViewController, MGLMapViewDelegate {
207206
guard let view = previewInstructionsView else { return }
208207
view.removeFromSuperview()
209208

210-
// reclaim the delegate, from the preview banner
209+
// reclaim the delegate, from the preview banner
211210
instructionsBannerView.delegate = self
212211

213212
// nil out both the view and index

Example/FavoritesList.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import CarPlay
44
import CoreLocation
55

66
public enum FavoritesList {
7-
87
enum POI: RawRepresentable {
98
typealias RawValue = String
109
case mapboxSF, timesSquare

Example/MBViewController.h

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)