Skip to content

Commit cc0889f

Browse files
authored
Remove unneeded if available iOS 12 (#4320)
* Remove unneeded if available iOS 12 * Remove canImport(CarPlay) checks
1 parent 736978b commit cc0889f

22 files changed

+0
-57
lines changed

Example/AppDelegate+CarPlay.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ extension NavigationGeocodedPlacemark {
3535
- Download and select the provisioning profile for the "Example-CarPlay" example app
3636
- Be sure to select an iOS simulator or device running iOS 12 or greater
3737
*/
38-
@available(iOS 12.0, *)
3938
extension AppDelegate: CPApplicationDelegate {
4039

4140
func application(_ application: UIApplication,
@@ -67,7 +66,6 @@ extension AppDelegate: CPApplicationDelegate {
6766

6867
// MARK: - CarPlayManagerDelegate methods
6968

70-
@available(iOS 12.0, *)
7169
extension AppDelegate: CarPlayManagerDelegate {
7270

7371
func carPlayManager(_ carPlayManager: CarPlayManager,
@@ -264,7 +262,6 @@ extension AppDelegate: CarPlayManagerDelegate {
264262

265263
// MARK: - CarPlaySearchControllerDelegate methods
266264

267-
@available(iOS 12.0, *)
268265
extension AppDelegate: CarPlaySearchControllerDelegate {
269266

270267
struct MaximumSearchResults {
@@ -452,7 +449,6 @@ extension GeocodedPlacemark {
452449

453450
// MARK: - CPListTemplateDelegate methods
454451

455-
@available(iOS 12.0, *)
456452
extension AppDelegate: CPListTemplateDelegate {
457453

458454
func listTemplate(_ listTemplate: CPListTemplate,

Example/AppDelegate.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1111
var window: UIWindow?
1212

1313
var _carPlayManager: Any? = nil
14-
@available(iOS 12.0, *)
1514
var carPlayManager: CarPlayManager {
1615
if _carPlayManager == nil {
1716
_carPlayManager = CarPlayManager(customRoutingProvider: MapboxRoutingProvider(.hybrid))
@@ -21,7 +20,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2120
}
2221

2322
var _carPlaySearchController: Any? = nil
24-
@available(iOS 12.0, *)
2523
var carPlaySearchController: CarPlaySearchController {
2624
if _carPlaySearchController == nil {
2725
_carPlaySearchController = CarPlaySearchController()
@@ -39,7 +37,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3937
}()
4038

4139
var _recentSearchItems: [Any]? = nil
42-
@available(iOS 12.0, *)
4340
var recentSearchItems: [CPListItem]? {
4441
get {
4542
_recentSearchItems as! [CPListItem]?

Example/FavoritesList.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public enum FavoritesList {
4646
}
4747
}
4848

49-
@available(iOS 12.0, *)
5049
func listItem() -> CPListItem {
5150
return CPListItem(text: rawValue, detailText: subTitle, image: nil, showsDisclosureIndicator: true)
5251
}

Sources/MapboxNavigation/CPInterfaceController.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import CarPlay
22

3-
@available(iOS 12.0, *)
43
public extension CPInterfaceController {
54

65
/**

Sources/MapboxNavigation/CPMapTemplate.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import Foundation
22
import MapboxDirections
33
import CarPlay
44

5-
@available(iOS 12.0, *)
65
extension CLLocationDirection {
76
init?(panDirection: CPMapTemplate.PanDirection) {
87
var horizontalBias: Double? = nil

Sources/MapboxNavigation/CPRouteChoice.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import CarPlay
22
import MapboxDirections
33
import MapboxCoreNavigation
44

5-
@available(iOS 12.0, *)
65
extension CPRouteChoice {
76

87
struct IndexedRouteResponseUserInfo {

Sources/MapboxNavigation/CPTrip.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import MapboxDirections
22
import MapboxCoreNavigation
33
import CarPlay
44

5-
@available(iOS 12.0, *)
65
extension CPTrip {
76

87
convenience init(indexedRouteResponse: IndexedRouteResponse) {

Sources/MapboxNavigation/CarPlayManager.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import MapboxMaps
1010

1111
- note: It is very important you have a single `CarPlayManager` instance at any given time. This should be managed by your `UIApplicationDelegate` class if you choose to supply your `accessToken` to the `CarPlayManager.eventsManager` via `NavigationEventsManager` initializer, instead of the Info.plist.
1212
*/
13-
@available(iOS 12.0, *)
1413
public class CarPlayManager: NSObject {
1514

1615
// MARK: CarPlay Infrastructure
@@ -360,7 +359,6 @@ public class CarPlayManager: NSObject {
360359

361360
// MARK: CPApplicationDelegate Methods
362361

363-
@available(iOS 12.0, *)
364362
extension CarPlayManager: CPApplicationDelegate {
365363

366364
public func application(_ application: UIApplication,
@@ -485,7 +483,6 @@ extension CarPlayManager: CPApplicationDelegate {
485483

486484
// MARK: CPInterfaceControllerDelegate Methods
487485

488-
@available(iOS 12.0, *)
489486
extension CarPlayManager: CPInterfaceControllerDelegate {
490487

491488
public func templateWillAppear(_ template: CPTemplate, animated: Bool) {
@@ -533,7 +530,6 @@ extension CarPlayManager: CPInterfaceControllerDelegate {
533530
}
534531
}
535532

536-
@available(iOS 12.0, *)
537533
extension CarPlayManager {
538534

539535
// MARK: Route Preview
@@ -698,7 +694,6 @@ extension CarPlayManager {
698694

699695
// MARK: CPMapTemplateDelegate Methods
700696

701-
@available(iOS 12.0, *)
702697
extension CarPlayManager: CPMapTemplateDelegate {
703698

704699
public func mapTemplate(_ mapTemplate: CPMapTemplate,
@@ -1067,7 +1062,6 @@ extension CarPlayManager: CPMapTemplateDelegate {
10671062

10681063
// MARK: CarPlayNavigationViewControllerDelegate Methods
10691064

1070-
@available(iOS 12.0, *)
10711065
extension CarPlayManager: CarPlayNavigationViewControllerDelegate {
10721066

10731067
public func carPlayNavigationViewControllerWillDismiss(_ carPlayNavigationViewController: CarPlayNavigationViewController,
@@ -1154,7 +1148,6 @@ extension CarPlayManager: CarPlayNavigationViewControllerDelegate {
11541148

11551149
// MARK: CarPlayMapViewControllerDelegate Methods
11561150

1157-
@available(iOS 12.0, *)
11581151
extension CarPlayManager: CarPlayMapViewControllerDelegate {
11591152

11601153
public func carPlayMapViewController(_ carPlayMapViewController: CarPlayMapViewController,
@@ -1203,7 +1196,6 @@ extension CarPlayManager: CarPlayMapViewControllerDelegate {
12031196

12041197
// MARK: MapTemplateProviderDelegate Methods
12051198

1206-
@available(iOS 12.0, *)
12071199
extension CarPlayManager: MapTemplateProviderDelegate {
12081200

12091201
func mapTemplateProvider(_ provider: MapTemplateProvider,
@@ -1281,7 +1273,6 @@ extension CarPlayManager {
12811273

12821274
// MARK: CarPlayManager Constants
12831275

1284-
@available(iOS 12.0, *)
12851276
extension CarPlayManager {
12861277

12871278
static let currentActivityKey = "com.mapbox.navigation.currentActivity"

Sources/MapboxNavigation/CarPlayManagerDelegate.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import MapboxMaps
1111

1212
If no delegate is set, a default built-in `MapboxNavigationService` will be created and used when a trip begins.
1313
*/
14-
@available(iOS 12.0, *)
1514
public protocol CarPlayManagerDelegate: AnyObject, UnimplementedLogging, CarPlayManagerDelegateDeprecations {
1615

1716
// MARK: Customizing the Bar Buttons
@@ -427,7 +426,6 @@ public protocol CarPlayManagerDelegate: AnyObject, UnimplementedLogging, CarPlay
427426
in mapTemplate: CPMapTemplate) -> Bool
428427
}
429428

430-
@available(iOS 12.0, *)
431429
public extension CarPlayManagerDelegate {
432430
/**
433431
`UnimplementedLogging` prints a warning to standard output the first time this method is called.
@@ -700,7 +698,6 @@ public extension CarPlayManagerDelegate {
700698

701699
This protocol redeclares the deprecated methods of the `CarPlayManagerDelegate` protocol for the purpose of calling implementations of these methods that have not been upgraded yet.
702700
*/
703-
@available(iOS 12.0, *)
704701
public protocol CarPlayManagerDelegateDeprecations {
705702
func carPlayManager(_ carPlayManager: CarPlayManager,
706703
navigationServiceFor routeResponse: RouteResponse,

Sources/MapboxNavigation/CarPlayMapViewController.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@ import Foundation
22
@_spi(Restricted) import MapboxMaps
33
import MapboxCoreNavigation
44
import MapboxDirections
5-
6-
#if canImport(CarPlay)
75
import CarPlay
86

97
/**
108
`CarPlayMapViewController` is responsible for administering the Mapbox map, the interface styles and the map template buttons to display on CarPlay.
119
*/
12-
@available(iOS 12.0, *)
1310
open class CarPlayMapViewController: UIViewController {
1411

1512
// MARK: UI Elements Configuration
@@ -386,7 +383,6 @@ open class CarPlayMapViewController: UIViewController {
386383

387384
// MARK: StyleManagerDelegate Methods
388385

389-
@available(iOS 12.0, *)
390386
extension CarPlayMapViewController: StyleManagerDelegate {
391387

392388
public func location(for styleManager: StyleManager) -> CLLocation? {
@@ -420,7 +416,6 @@ extension CarPlayMapViewController: StyleManagerDelegate {
420416

421417
// MARK: NavigationMapViewDelegate Methods
422418

423-
@available(iOS 12.0, *)
424419
extension CarPlayMapViewController: NavigationMapViewDelegate {
425420

426421
public func navigationMapView(_ navigationMapView: NavigationMapView,
@@ -460,7 +455,6 @@ extension CarPlayMapViewController: NavigationMapViewDelegate {
460455
}
461456
}
462457

463-
@available(iOS 12.0, *)
464458
extension CarPlayMapViewController: CPSessionConfigurationDelegate {
465459

466460
@available(iOS 13.0, *)
@@ -469,4 +463,3 @@ extension CarPlayMapViewController: CPSessionConfigurationDelegate {
469463
applyStyleIfNeeded(contentStyle)
470464
}
471465
}
472-
#endif

0 commit comments

Comments
 (0)