Skip to content

Commit

Permalink
Merge pull request #2230 from mapbox/jerrad/objc-delenda-est
Browse files Browse the repository at this point in the history
1.0 Objective-C Obsoletion
  • Loading branch information
JThramer authored Nov 20, 2019
2 parents 420b287 + 2a1ac22 commit 9cbbd2f
Show file tree
Hide file tree
Showing 206 changed files with 2,177 additions and 2,518 deletions.
3 changes: 0 additions & 3 deletions Bench/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

window = UIWindow(frame: UIScreen.main.bounds)

if isRunningTests() {
Expand Down
5 changes: 0 additions & 5 deletions Bench/BenchViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ struct Item {
}

class BenchViewController: UITableViewController {

var dataSource = [Section]()
let cellIdentifier = "cellId"

override func viewDidLoad() {

super.viewDidLoad()

tableView.register(UITableViewCell.self, forCellReuseIdentifier: cellIdentifier)
Expand Down Expand Up @@ -66,7 +64,6 @@ class BenchViewController: UITableViewController {
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath)
let item = dataSource[indexPath.section].items[indexPath.row]

Expand All @@ -76,7 +73,6 @@ class BenchViewController: UITableViewController {
}

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

tableView.deselectRow(at: indexPath, animated: true)

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

extension BenchViewController: NavigationViewControllerDelegate {

func navigationViewControllerDidDismiss(_ navigationViewController: NavigationViewController, byCanceling canceled: Bool) {
navigationController?.popViewController(animated: true)
}
Expand Down
2 changes: 0 additions & 2 deletions Bench/ControlRouteViewController.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import UIKit
import MapboxNavigation


class ControlRouteViewController: NavigationViewController {

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

Expand Down
7 changes: 0 additions & 7 deletions BenchTests/BenchTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import MapboxDirections
@testable import MapboxNavigation
@testable import Bench


class BenchTests: XCTestCase, CLLocationManagerDelegate {

let token = "deadbeef"

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

func testControlRoute1() {

let route = Fixture.route(from: "PipeFittersUnion-FourSeasonsBoston")
let trace = Fixture.locations(from: "PipeFittersUnion-FourSeasonsBoston.trace")

Expand All @@ -33,7 +30,6 @@ class BenchTests: XCTestCase, CLLocationManagerDelegate {
}

func testControlRoute2() {

let route = Fixture.route(from: "DCA-Arboretum")
let trace = Fixture.locations(from: "DCA-Arboretum.trace")

Expand All @@ -50,7 +46,6 @@ class BenchTests: XCTestCase, CLLocationManagerDelegate {
}

func navigationViewController(route: Route, locationManager: ReplayLocationManager) -> NavigationViewController {

let speechAPI = SpeechAPISpy(accessToken: token)
let directions = DirectionsSpy(accessToken: token)
let service = MapboxNavigationService(route: route,
Expand All @@ -66,5 +61,3 @@ class BenchTests: XCTestCase, CLLocationManagerDelegate {
return NavigationViewController(for: route, options: options)
}
}


2 changes: 0 additions & 2 deletions BenchUITests/BenchUITests.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import XCTest

class BenchUITests: XCTestCase {

override func setUp() {
continueAfterFailure = false
XCUIApplication().launch()
}

func testExample() {

}
}
17 changes: 15 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,22 @@

## master

### Packaging
* 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))

### User interface
* `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))
* Fixed an issue where user notifications displayed right turn arrows for left turn maneuvers. ([#2270](https://github.com/mapbox/mapbox-navigation-ios/pull/2270))
* Renamed `NavigationMapView.showRoutes(_:legIndex:)` to `NavigationMapView.show(_:legIndex:)`. ([#2230](https://github.com/mapbox/mapbox-navigation-ios/pull/2230))
* Renamed `NavigationMapView.showWaypoints(_:legIndex:)` to `NavigationMapView.showWaypoints(on:legIndex:)`. ([#2230](https://github.com/mapbox/mapbox-navigation-ios/pull/2230))
* Renamed `MapboxVoiceController.play(_:)` to `MapboxVoiceController.play(instruction:data:)`. ([#2230](https://github.com/mapbox/mapbox-navigation-ios/pull/2230))

### Error handling
* The `MapboxVoiceController` and `RouteVoiceController` now emit `SpeechError`s instead of an `NSError` object. ([#2230](https://github.com/mapbox/mapbox-navigation-ios/pull/2230))
* 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))

### Other changes
* 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))

## v0.38.0

Expand Down Expand Up @@ -146,7 +161,6 @@
* 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))
* 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))


### Other changes

* 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))
Expand Down Expand Up @@ -630,7 +644,6 @@

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


## v0.13.1 (February 7, 2018)

### Core Navigation
Expand Down
6 changes: 3 additions & 3 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" "5.2.0"
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" "5.5.0"
binary "https://www.mapbox.com/ios-sdk/MapboxNavigationNative.json" "6.2.1"
github "AndriiDoroshko/SnappyShrimp" "1.6.4"
github "CedarBDD/Cedar" "v1.0"
github "Quick/Nimble" "v8.0.2"
github "Quick/Quick" "v2.1.0"
github "Quick/Nimble" "v8.0.4"
github "Quick/Quick" "v2.2.0"
github "ceeK/Solar" "2.1.0"
github "mapbox/MapboxDirections.swift" "v0.30.0"
github "mapbox/MapboxGeocoder.swift" "v0.10.2"
Expand Down
9 changes: 1 addition & 8 deletions Example/AppDelegate+CarPlay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ let CarPlayWaypointKey: String = "MBCarPlayWaypoint"
*/
@available(iOS 12.0, *)
extension AppDelegate: CPApplicationDelegate {

// MARK: CPApplicationDelegate

func application(_ application: UIApplication, didConnectCarInterfaceController interfaceController: CPInterfaceController, to window: CPWindow) {
Expand All @@ -46,15 +45,13 @@ extension AppDelegate: CPApplicationDelegate {
@available(iOS 12.0, *)
extension AppDelegate: CarPlayManagerDelegate {
func carPlayManager(_ carPlayManager: CarPlayManager, navigationServiceAlong route: Route, desiredSimulationMode: SimulationMode) -> NavigationService {

if let nvc = self.window?.rootViewController?.presentedViewController as? NavigationViewController, let service = nvc.navigationService {
//Do not set simulation mode if we already have an active navigation session.
return service
}
return MapboxNavigationService(route: route, simulating: desiredSimulationMode)
}


// MARK: CarPlayManagerDelegate
func carPlayManager(_ carPlayManager: CarPlayManager, didBeginNavigationWith service: NavigationService) {
currentAppRootViewController?.beginNavigationWithCarplay(navigationService: service)
Expand All @@ -78,7 +75,6 @@ extension AppDelegate: CarPlayManagerDelegate {
}

func carPlayManager(_ carPlayManager: CarPlayManager, leadingNavigationBarButtonsCompatibleWith traitCollection: UITraitCollection, in template: CPTemplate, for activity: CarPlayActivity) -> [CPBarButton]? {

guard let interfaceController = self.carPlayManager.interfaceController else {
return nil
}
Expand Down Expand Up @@ -107,7 +103,6 @@ extension AppDelegate: CarPlayManagerDelegate {
}

func carPlayManager(_ carPlayManager: CarPlayManager, trailingNavigationBarButtonsCompatibleWith traitCollection: UITraitCollection, in template: CPTemplate, for activity: CarPlayActivity) -> [CPBarButton]? {

switch activity {
case .previewing:
let disableSimulateText = "Disable Simulation"
Expand All @@ -133,11 +128,10 @@ extension AppDelegate: CarPlayManagerDelegate {
}

func carPlayManager(_ carPlayManager: CarPlayManager, mapButtonsCompatibleWith traitCollection: UITraitCollection, in template: CPTemplate, for activity: CarPlayActivity) -> [CPMapButton]? {

switch activity {
case .browsing:
guard let mapViewController = carPlayManager.carPlayMapViewController,
let mapTemplate = template as? CPMapTemplate else {
let mapTemplate = template as? CPMapTemplate else {
return nil
}
var mapButtons = [mapViewController.recenterButton,
Expand Down Expand Up @@ -175,7 +169,6 @@ extension AppDelegate: CarPlaySearchControllerDelegate {

@available(iOS 12.0, *)
extension AppDelegate: CPListTemplateDelegate {

func listTemplate(_ listTemplate: CPListTemplate, didSelect item: CPListItem, completionHandler: @escaping () -> Void) {
// Selected a favorite
if let userInfo = item.userInfo as? [String: Any],
Expand Down
3 changes: 0 additions & 3 deletions Example/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import UIKit
import MapboxNavigation


@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

weak var currentAppRootViewController: ViewController?

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

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

if isRunningTests() {
window!.rootViewController = UIViewController()
}
Expand Down
5 changes: 2 additions & 3 deletions Example/CustomStyles.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Foundation
import MapboxNavigation

// MARK: CustomDayStyle

/**
To find more pieces of the UI to customize, checkout DayStyle.swift.
*/
// MARK: CustomDayStyle
class CustomDayStyle: DayStyle {

required init() {
super.init()
mapStyleURL = URL(string: "mapbox://styles/mapbox/satellite-streets-v9")!
Expand All @@ -22,7 +22,6 @@ class CustomDayStyle: DayStyle {

// MARK: CustomNightStyle
class CustomNightStyle: NightStyle {

required init() {
super.init()
mapStyleURL = URL(string: "mapbox://styles/mapbox/satellite-streets-v9")!
Expand Down
13 changes: 6 additions & 7 deletions Example/CustomViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import MapboxDirections
import Turf

class CustomViewController: UIViewController, MGLMapViewDelegate {

var destination: MGLPointAnnotation!
let directions = Directions.shared
var navigationService: NavigationService!
Expand Down Expand Up @@ -81,7 +80,7 @@ class CustomViewController: UIViewController, MGLMapViewDelegate {
}

func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {
self.mapView.showRoutes([navigationService.route])
self.mapView.show([navigationService.route])
}

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

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

// find the leg that contains the step, legIndex, and stepIndex
guard let leg = route.legs.first(where: { $0.steps.contains(step) }),
let legIndex = route.legs.firstIndex(of: leg),
let stepIndex = leg.steps.firstIndex(of: step) else {
guard let leg = route.legs.first(where: { $0.steps.contains(step) }),
let legIndex = route.legs.firstIndex(of: leg),
let stepIndex = leg.steps.firstIndex(of: step) else {
return
}

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

// reclaim the delegate, from the preview banner
// reclaim the delegate, from the preview banner
instructionsBannerView.delegate = self

// nil out both the view and index
Expand Down
1 change: 0 additions & 1 deletion Example/FavoritesList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import CarPlay
import CoreLocation

public enum FavoritesList {

enum POI: RawRepresentable {
typealias RawValue = String
case mapboxSF, timesSquare
Expand Down
9 changes: 0 additions & 9 deletions Example/MBViewController.h

This file was deleted.

Loading

0 comments on commit 9cbbd2f

Please sign in to comment.