Skip to content

Commit ee0465d

Browse files
authored
Remove outdated availability attributes (#2409)
1 parent 12f6598 commit ee0465d

File tree

138 files changed

+186
-629
lines changed

Some content is hidden

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

138 files changed

+186
-629
lines changed

Examples.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@
10811081
GCC_WARN_UNUSED_FUNCTION = YES;
10821082
GCC_WARN_UNUSED_LABEL = YES;
10831083
GCC_WARN_UNUSED_VARIABLE = YES;
1084-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
1084+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
10851085
LD_GENERATE_MAP_FILE = YES;
10861086
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
10871087
MTL_FAST_MATH = YES;
@@ -1216,7 +1216,7 @@
12161216
GCC_WARN_UNUSED_FUNCTION = YES;
12171217
GCC_WARN_UNUSED_LABEL = YES;
12181218
GCC_WARN_UNUSED_VARIABLE = YES;
1219-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
1219+
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
12201220
LD_GENERATE_MAP_FILE = YES;
12211221
MTL_ENABLE_DEBUG_INFO = NO;
12221222
MTL_FAST_MATH = YES;

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let package = Package(
1414
name: "MapboxMaps",
1515
defaultLocalization: "en",
1616
// Maps SDK doesn't support macOS but declared the minimum macOS requirement with downstream deps to enable `swift run` cli tools
17-
platforms: [.iOS(.v12), .macOS(.v10_15), .custom("visionos", versionString: "1.0")],
17+
platforms: [.iOS(.v14), .macOS(.v10_15), .custom("visionos", versionString: "1.0")],
1818
products: [
1919
.library(
2020
name: "MapboxMaps",

Sources/Examples/All Examples/BasicLocationPulsingExample.swift

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,8 @@ final class BasicLocationPulsingExample: UIViewController, ExampleProtocol {
3232
mapView.mapboxMap.setCamera(to: .init(center: location.coordinate, zoom: 18))
3333
}.store(in: &cancelables)
3434

35-
if #available(iOS 14.0, *) {
36-
navigationItem.rightBarButtonItem = UIBarButtonItem(systemItem: .action)
37-
updateMenu()
38-
} else {
39-
navigationItem.rightBarButtonItem = UIBarButtonItem(
40-
barButtonSystemItem: .action,
41-
target: self,
42-
action: #selector(showOptions)
43-
)
44-
}
35+
navigationItem.rightBarButtonItem = UIBarButtonItem(systemItem: .action)
36+
updateMenu()
4537
}
4638

4739
override func viewDidAppear(_ animated: Bool) {
@@ -75,36 +67,6 @@ final class BasicLocationPulsingExample: UIViewController, ExampleProtocol {
7567
mapView.location.options.puckType = .puck2D(.makeDefault())
7668
}
7769

78-
@objc private func showOptions() {
79-
let constantPulseAction = UIAlertAction(title: "Pulse with constant radius", style: .default) { _ in
80-
self.enablePulsingWithConstantRadius()
81-
}
82-
let accuracyPulseAction = UIAlertAction(title: "Pulse with accuracy radius", style: .default) { _ in
83-
self.enablePulsingWithAccuracyRadius()
84-
}
85-
let stopPulseAction = UIAlertAction(title: "None", style: .default) { _ in
86-
self.disablePulsing()
87-
}
88-
89-
let staticAccuracyRingAction = UIAlertAction(title: "Static with accuracy radius", style: .default) { _ in
90-
self.enableStaticAccuracyCircle()
91-
}
92-
93-
let cancelAction = UIAlertAction(title: "Dismiss", style: .cancel)
94-
95-
let controller = UIAlertController(title: "Puck circle", message: nil, preferredStyle: .actionSheet)
96-
controller.modalPresentationStyle = .popover
97-
if #available(iOS 16.0, *) {
98-
controller.popoverPresentationController?.sourceItem = navigationItem.rightBarButtonItem
99-
} else {
100-
controller.popoverPresentationController?.barButtonItem = navigationItem.rightBarButtonItem
101-
}
102-
[constantPulseAction, accuracyPulseAction, staticAccuracyRingAction, stopPulseAction, cancelAction]
103-
.forEach(controller.addAction)
104-
105-
present(controller, animated: true)
106-
}
107-
10870
private func updateMenu() {
10971
let state = mapView.location.options.puckType.map { type -> PuckCircle? in
11072
if case PuckType.puck2D(let config) = type {

Sources/Examples/All Examples/BuildingExtrusionsExample.swift

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,60 +19,40 @@ final class BuildingExtrusionsExample: UIViewController, ExampleProtocol {
1919

2020
private lazy var lightPositionButton: UIButton = {
2121
let button = UIButton.exampleActionButton()
22-
if #available(iOS 13.1, *) {
23-
button.setImage(UIImage(systemName: "flashlight.on.fill"), for: .normal)
24-
} else {
25-
button.setTitle("Position", for: .normal)
26-
}
22+
button.setImage(UIImage(systemName: "flashlight.on.fill"), for: .normal)
2723
button.addTarget(self, action: #selector(lightPositionButtonTapped(_:)), for: .primaryActionTriggered)
2824
return button
2925
}()
3026

3127
private lazy var lightColorButton: UIButton = {
3228
let button = UIButton.exampleActionButton()
33-
if #available(iOS 13.0, *) {
34-
button.setImage(UIImage(systemName: "paintbrush.fill"), for: .normal)
35-
} else {
36-
button.setTitle("Color", for: .normal)
37-
}
29+
button.setImage(UIImage(systemName: "paintbrush.fill"), for: .normal)
3830
button.addTarget(self, action: #selector(lightColorButtonTapped(_:)), for: .primaryActionTriggered)
3931
return button
4032
}()
4133

4234
private lazy var heightAlignmentButton: UIButton = {
4335
let button = UIButton.exampleActionButton()
4436

45-
if #available(iOS 15.0, *) {
46-
button.setImage(UIImage(systemName: "align.vertical.top"), for: .normal)
47-
button.setImage(UIImage(systemName: "align.vertical.top.fill"), for: .selected)
48-
} else {
49-
button.setTitle("Height Alignment", for: .normal)
50-
}
37+
button.setImage(UIImage(systemName: "align.vertical.top"), for: .normal)
38+
button.setImage(UIImage(systemName: "align.vertical.top.fill"), for: .selected)
5139
button.addTarget(self, action: #selector(heightAlignmentButtonTapped(_:)), for: .primaryActionTriggered)
5240
return button
5341
}()
5442

5543
private lazy var baseAlignmentButton: UIButton = {
5644
let button = UIButton.exampleActionButton()
5745

58-
if #available(iOS 15.0, *) {
59-
button.setImage(UIImage(systemName: "align.vertical.bottom"), for: .normal)
60-
button.setImage(UIImage(systemName: "align.vertical.bottom.fill"), for: .selected)
61-
} else {
62-
button.setTitle("Height Alignment", for: .normal)
63-
}
46+
button.setImage(UIImage(systemName: "align.vertical.bottom"), for: .normal)
47+
button.setImage(UIImage(systemName: "align.vertical.bottom.fill"), for: .selected)
6448
button.addTarget(self, action: #selector(baseAlignmentButtonTapped(_:)), for: .primaryActionTriggered)
6549
return button
6650
}()
6751

6852
private lazy var terrainSwitchButton: UIButton = {
6953
let button = UIButton.exampleActionButton()
70-
if #available(iOS 15.0, *) {
71-
button.setImage(UIImage(systemName: "mountain.2"), for: .normal)
72-
button.setImage(UIImage(systemName: "mountain.2.fill"), for: .selected)
73-
} else {
74-
button.setTitle("Terrain", for: .normal)
75-
}
54+
button.setImage(UIImage(systemName: "mountain.2"), for: .normal)
55+
button.setImage(UIImage(systemName: "mountain.2.fill"), for: .selected)
7656

7757
button.addTarget(self, action: #selector(terrainButtonTapped(_:)), for: .primaryActionTriggered)
7858
return button

Sources/Examples/All Examples/CarPlay/ApplicationCarPlaySceneDelegage.swift

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@ class ApplicationCarPlaySceneDelegage: NSObject, CPTemplateApplicationSceneDeleg
66
func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene, didConnect interfaceController: CPInterfaceController, to window: CPWindow) {
77
window.rootViewController = applicationVC
88
let mapTemplate = CPMapTemplate()
9-
if #available(iOS 14.0, *) {
10-
mapTemplate.leadingNavigationBarButtons = [
11-
CPBarButton(title: "Start") { _ in
12-
CarPlayViewController.shared.play()
13-
}
14-
]
15-
mapTemplate.trailingNavigationBarButtons = [
16-
CPBarButton(title: "Stop") { _ in
17-
CarPlayViewController.shared.stop()
18-
}
19-
]
20-
}
9+
mapTemplate.leadingNavigationBarButtons = [
10+
CPBarButton(title: "Start") { _ in
11+
CarPlayViewController.shared.play()
12+
}
13+
]
14+
mapTemplate.trailingNavigationBarButtons = [
15+
CPBarButton(title: "Stop") { _ in
16+
CarPlayViewController.shared.stop()
17+
}
18+
]
2119
interfaceController.setRootTemplate(mapTemplate, animated: false, completion: nil)
2220
}
2321

Sources/Examples/All Examples/CustomLayerExample.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@ final class CustomLayerExample: UIViewController, ExampleProtocol {
2525

2626
mapView = MapView(frame: view.bounds, mapInitOptions: MapInitOptions(cameraOptions: cameraOptions))
2727
mapView.mapboxMap.mapStyle = .streets
28-
if #available(iOS 13.0, *) {
29-
mapView.mapboxMap.setMapStyleContent {
30-
StyleProjection(name: .mercator)
31-
CustomLayer(id: "custom-layer-example", renderer: renderer)
32-
.position(.below("waterway"))
33-
}
28+
mapView.mapboxMap.setMapStyleContent {
29+
StyleProjection(name: .mercator)
30+
CustomLayer(id: "custom-layer-example", renderer: renderer)
31+
.position(.below("waterway"))
3432
}
3533

3634
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]

Sources/Examples/All Examples/DebugMapExample.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ final class DebugMapExample: UIViewController, ExampleProtocol {
2424
super.viewDidLoad()
2525

2626
mapView = MapView(frame: view.bounds)
27-
if #available(iOS 15.0, *) {
28-
let maxFPS = Float(UIScreen.main.maximumFramesPerSecond)
29-
mapView.preferredFrameRateRange = CAFrameRateRange(minimum: 1, maximum: maxFPS, preferred: maxFPS)
30-
}
27+
let maxFPS = Float(UIScreen.main.maximumFramesPerSecond)
28+
mapView.preferredFrameRateRange = CAFrameRateRange(minimum: 1, maximum: maxFPS, preferred: maxFPS)
3129

3230
view.addSubview(mapView)
3331
view.backgroundColor = .skyBlue

Sources/Examples/All Examples/Lab/CombineExample.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ private extension UILabel {
4343
static func makeCameraLabel() -> UILabel {
4444
let label = UILabel()
4545
label.numberOfLines = 0
46-
if #available(iOS 13.0, *) {
47-
label.backgroundColor = UIColor.systemBackground
48-
} else {
49-
label.backgroundColor = .white
50-
}
46+
label.backgroundColor = UIColor.systemBackground
5147
label.layer.cornerRadius = 5
5248
label.layer.masksToBounds = true
5349
return label
@@ -57,9 +53,7 @@ private extension UILabel {
5753
private extension NSAttributedString {
5854
static func logString(_ text: String, bold: Bool = false) -> NSAttributedString {
5955
var attributes = [NSAttributedString.Key: Any]()
60-
if #available(iOS 13.0, *) {
61-
attributes[.font] = UIFont.monospacedSystemFont(ofSize: 13, weight: bold ? .bold : .regular)
62-
}
56+
attributes[.font] = UIFont.monospacedSystemFont(ofSize: 13, weight: bold ? .bold : .regular)
6357
return NSAttributedString(string: text, attributes: attributes)
6458
}
6559

Sources/Examples/All Examples/Lab/Lights3DExample.swift

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,34 +30,28 @@ final class Lights3DExample: UIViewController, ExampleProtocol {
3030
}
3131

3232
func sunAnimationButton() -> UIBarButtonItem {
33-
if #available(iOS 13, *) {
34-
return UIBarButtonItem(image: UIImage(systemName: "sunrise"), style: .plain, target: self, action: #selector(startSunAnimation))
35-
} else {
36-
return UIBarButtonItem(title: "Sun", style: .plain, target: self, action: #selector(startSunAnimation))
37-
}
33+
return UIBarButtonItem(image: UIImage(systemName: "sunrise"), style: .plain, target: self, action: #selector(startSunAnimation))
3834
}
3935

4036
func updateMapState(azimuth: Double = 210, polarAngle: Double = 30, ambientColor: UIColor = .lightGray) {
41-
if #available(iOS 13.0, *) {
42-
/// We use the new experimental style content feature to set the lights.
43-
mapView.mapboxMap.setMapStyleContent {
44-
Atmosphere()
45-
.range(start: 0, end: 12)
46-
.horizonBlend(0.1)
47-
.starIntensity(0.2)
48-
.color(StyleColor(red: 240, green: 196, blue: 152, alpha: 1)!)
49-
.highColor(StyleColor(red: 221, green: 209, blue: 197, alpha: 1)!)
50-
.spaceColor(StyleColor(red: 153, green: 180, blue: 197, alpha: 1)!)
51-
DirectionalLight(id: directionalLightId)
52-
.intensity(0.5)
53-
.direction(azimuthal: azimuth, polar: polarAngle)
54-
.directionTransition(.zero)
55-
.castShadows(true)
56-
.shadowIntensity(1)
57-
AmbientLight(id: ambientLightId)
58-
.color(ambientColor)
59-
.intensity(0.5)
60-
}
37+
/// We use the new experimental style content feature to set the lights.
38+
mapView.mapboxMap.setMapStyleContent {
39+
Atmosphere()
40+
.range(start: 0, end: 12)
41+
.horizonBlend(0.1)
42+
.starIntensity(0.2)
43+
.color(StyleColor(red: 240, green: 196, blue: 152, alpha: 1)!)
44+
.highColor(StyleColor(red: 221, green: 209, blue: 197, alpha: 1)!)
45+
.spaceColor(StyleColor(red: 153, green: 180, blue: 197, alpha: 1)!)
46+
DirectionalLight(id: directionalLightId)
47+
.intensity(0.5)
48+
.direction(azimuthal: azimuth, polar: polarAngle)
49+
.directionTransition(.zero)
50+
.castShadows(true)
51+
.shadowIntensity(1)
52+
AmbientLight(id: ambientLightId)
53+
.color(ambientColor)
54+
.intensity(0.5)
6155
}
6256
}
6357

Sources/Examples/All Examples/Lab/MapEventsExample.swift

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ final class MapEventsExample: UIViewController, ExampleProtocol {
1616
override func viewDidLoad() {
1717
super.viewDidLoad()
1818

19-
if #available(iOS 13, *) {
20-
view.backgroundColor = .systemBackground
21-
} else {
22-
view.backgroundColor = .white
23-
}
19+
view.backgroundColor = .systemBackground
2420

2521
mapView = MapView(frame: view.bounds)
2622
mapView.ornaments.options.scaleBar.visibility = .visible
@@ -145,9 +141,7 @@ extension LogableEvent {
145141
private extension NSAttributedString {
146142
static func logString(_ text: String, bold: Bool = false) -> NSAttributedString {
147143
var attributes = [NSAttributedString.Key: Any]()
148-
if #available(iOS 13.0, *) {
149-
attributes[.font] = UIFont.monospacedSystemFont(ofSize: 13, weight: bold ? .bold : .regular)
150-
}
144+
attributes[.font] = UIFont.monospacedSystemFont(ofSize: 13, weight: bold ? .bold : .regular)
151145
return NSAttributedString(string: text, attributes: attributes)
152146
}
153147

@@ -306,11 +300,7 @@ private extension UILabel {
306300
static func makeCameraLabel() -> UILabel {
307301
let label = UILabel()
308302
label.numberOfLines = 0
309-
if #available(iOS 13.0, *) {
310-
label.backgroundColor = UIColor.systemBackground
311-
} else {
312-
label.backgroundColor = .white
313-
}
303+
label.backgroundColor = UIColor.systemBackground
314304
label.layer.cornerRadius = 5
315305
label.layer.masksToBounds = true
316306
return label

0 commit comments

Comments
 (0)