Skip to content

Commit

Permalink
Update examples to the iOS 16+ (#2377)
Browse files Browse the repository at this point in the history
  • Loading branch information
OdNairy authored Dec 4, 2024
1 parent 5c9ce70 commit b8180c2
Show file tree
Hide file tree
Showing 46 changed files with 14 additions and 149 deletions.
6 changes: 6 additions & 0 deletions Apps/Examples/Examples.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,7 @@
APPLICATION_EXTENSION_API_ONLY = NO;
BUNDLE_LOADER = "$(TEST_HOST)";
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(PROJECT_DIR)/../lib";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxTests;
SDKROOT = auto;
Expand Down Expand Up @@ -1099,6 +1100,7 @@
APPLICATION_EXTENSION_API_ONLY = NO;
BUNDLE_LOADER = "$(TEST_HOST)";
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(PROJECT_DIR)/../lib";
PRODUCT_BUNDLE_IDENTIFIER = mapbox.ExamplesUITests;
SDKROOT = auto;
Expand All @@ -1123,6 +1125,7 @@
INFOPLIST_FILE = Examples/Info.plist;
INFOPLIST_PREFIX_HEADER = "$(DERIVED_FILE_DIR)/InfoPlist.Prefix.h";
INFOPLIST_PREPROCESS = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1238,6 +1241,7 @@
INFOPLIST_FILE = Examples/Info.plist;
INFOPLIST_PREFIX_HEADER = "$(DERIVED_FILE_DIR)/InfoPlist.Prefix.h";
INFOPLIST_PREPROCESS = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1262,6 +1266,7 @@
APPLICATION_EXTENSION_API_ONLY = NO;
BUNDLE_LOADER = "$(TEST_HOST)";
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(PROJECT_DIR)/../lib";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxTests;
SDKROOT = auto;
Expand All @@ -1280,6 +1285,7 @@
APPLICATION_EXTENSION_API_ONLY = NO;
BUNDLE_LOADER = "$(TEST_HOST)";
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(PROJECT_DIR)/../lib";
PRODUCT_BUNDLE_IDENTIFIER = mapbox.ExamplesUITests;
SDKROOT = auto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ final class BasicLocationPulsingExample: UIViewController, ExampleProtocol {
present(controller, animated: true)
}

@available(iOS 14.0, *)
private func updateMenu() {
let state = mapView.location.options.puckType.map { type -> PuckCircle? in
if case PuckType.puck2D(let config) = type {
Expand Down
1 change: 0 additions & 1 deletion Apps/Examples/Examples/All Examples/CameraForExample.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import UIKit
import MapboxMaps

@available(iOS 13.0, *)
final class CameraForExample: UIViewController, ExampleProtocol {
private var mapView: MapView!
private var cancelables = Set<AnyCancelable>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import CarPlay

@available(iOS 13.0, *)
class ApplicationCarPlaySceneDelegage: NSObject, CPTemplateApplicationSceneDelegate {
let applicationVC = CarPlayRootVC()

Expand All @@ -19,7 +18,7 @@ class ApplicationCarPlaySceneDelegage: NSObject, CPTemplateApplicationSceneDeleg
}
]
}
interfaceController.setRootTemplate(mapTemplate, animated: false)
interfaceController.setRootTemplate(mapTemplate, animated: false, completion: nil)
}

func sceneWillEnterForeground(_ scene: UIScene) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import CarPlay

@available(iOS 13.4, *)
class DashboardCarPlaySceneDelegate: NSObject, CPTemplateApplicationSceneDelegate, CPTemplateApplicationDashboardSceneDelegate {
let dashboardVC = CarPlayRootVC()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import CarPlay
import MapboxMaps

@available(iOS 15.4, *)
class InstrumentClusterCarPlaySceneDelegate: NSObject,
CPTemplateApplicationInstrumentClusterSceneDelegate,
CPInstrumentClusterControllerDelegate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ extension GeofencingExample {

private func showSpinnerIfNeeded() {
if geofencingSpinner == nil {
let spinner = UIActivityIndicatorView(style: .whiteLarge)
let spinner = UIActivityIndicatorView(style: .large)

spinner.translatesAutoresizingMaskIntoConstraints = false
spinner.startAnimating()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import MapboxMaps
import Combine

/// This examples shows how to use Map events with Combine framework.
@available(iOS 13.0, *)
final class CombineExample: UIViewController, ExampleProtocol {
private var mapView: MapView!
private var tokens = Set<AnyCancellable>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Combine
import Turf

/// This examples shows how to use Combine framework to drive the Puck's location and heading.
@available(iOS 13.0, *)
final class CombineLocationExample: UIViewController, ExampleProtocol {
@Published
private var location = Location(coordinate: CLLocationCoordinate2D(latitude: 60.17195694011002, longitude: 24.945389069265598))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ final class OfflineManagerExample: UIViewController, NonMapViewExampleProtocol {
private func resetUI() {
logger?.reset()
logView.textContainerInset.bottom = view.safeAreaInsets.bottom
logView.scrollIndicatorInsets.bottom = view.safeAreaInsets.bottom
logView.verticalScrollIndicatorInsets.bottom = view.safeAreaInsets.bottom

progressContainer.isHidden = false
stylePackProgressView.progress = 0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import MapboxMaps

/// This example shows how to use a slot from the Standard style and use another custom slot added at runtime
/// to split the former into two parts.
@available(iOS 13.0, *)
final class RuntimeSlotsExample: UIViewController, ExampleProtocol {
private var mapView: MapView!

Expand Down
15 changes: 2 additions & 13 deletions Apps/Examples/Examples/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

let appearance = UINavigationBar.appearance()
appearance.prefersLargeTitles = true

if #available(iOS 13.0, *) {
appearance.scrollEdgeAppearance = UINavigationBarAppearance()
}

if #unavailable(iOS 13.0) {
let examplesTableViewController = ExampleTableViewController()
let navigationController = UINavigationController(rootViewController: examplesTableViewController)
window?.rootViewController = navigationController
window?.makeKeyAndVisible()
}
appearance.scrollEdgeAppearance = UINavigationBarAppearance()

return true
}
Expand Down Expand Up @@ -97,7 +87,7 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
// This function will be called when the app receive notification
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
// show the notification alert (banner), and with sound
completionHandler([.alert, .sound])
completionHandler([.banner, .sound])
}

// This function will be called right after user tap on the notification
Expand All @@ -120,7 +110,6 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
}
}

@available(iOS 13.0, *)
final class SceneDelegate: NSObject, UISceneDelegate {
var windows: [UIWindow] = []

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ final class ExampleTableViewController: UITableViewController {
UserDefaults.standard.removeObject(forKey: startingExampleTitleKey)
}

@available(iOS 14.0, *)
@objc func openSwiftUI() {
present(createSwiftUIExamplesController(), animated: true)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import MapboxMaps
import SwiftUI

@available(iOS 14.0, *)
struct AnnotationsExample: View {
struct Tap: Identifiable {
var coordinate: CLLocationCoordinate2D
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Foundation
import SwiftUI
@_spi(Experimental) import MapboxMaps

@available(iOS 14.0, *)
struct ClipLayerExample: View {
@State private var settings = ClipLayerSettings()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ private enum Id {
static let source = "fire-hydrant-source"
}

@available(iOS 14.0, *)
struct ClusteringExample: View {
struct Detail: Identifiable {
var id = UUID()
Expand Down Expand Up @@ -47,7 +46,6 @@ struct ClusteringExample: View {
}
}

@available(iOS 14.0, *)
extension ClusteringExample.Detail {
init(title: String, message: String) {
self.title = title
Expand All @@ -71,7 +69,6 @@ extension ClusteringExample.Detail {
}
}

@available(iOS 14.0, *)
private func setupClusteringLayer(_ map: MapboxMap) throws {
// The image named `fire-station-11` is included in the app's Assets.xcassets bundle.
// In order to recolor an image, you need to add a template image to the map's style.
Expand Down Expand Up @@ -109,7 +106,6 @@ private func setupClusteringLayer(_ map: MapboxMap) throws {
try map.addLayer(clusterCountLayer)
}

@available(iOS 14.0, *)
private func createClusteredLayer() -> CircleLayer {
// Create a symbol layer to represent the clustered points.
var clusteredLayer = CircleLayer(id: Id.clusterCircle, source: Id.source)
Expand All @@ -136,7 +132,6 @@ private func createClusteredLayer() -> CircleLayer {
return clusteredLayer
}

@available(iOS 14.0, *)
private func createUnclusteredLayer() -> SymbolLayer {
// Create a symbol layer to represent the points that aren't clustered.
var unclusteredLayer = SymbolLayer(id: Id.point, source: Id.source)
Expand All @@ -159,7 +154,6 @@ private func createUnclusteredLayer() -> SymbolLayer {
return unclusteredLayer
}

@available(iOS 14.0, *)
private func createNumberLayer() -> SymbolLayer {
var numberLayer = SymbolLayer(id: Id.count, source: Id.source)

Expand All @@ -172,7 +166,6 @@ private func createNumberLayer() -> SymbolLayer {
return numberLayer
}

@available(iOS 14.0, *)
struct ClusteringExample_Preview: PreviewProvider {
static var previews: some View {
ClusteringExample()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import SwiftUI
@_spi(Experimental) import MapboxMaps

@available(iOS 14.0, *)
struct DynamicStylingExample: View {
enum CityCollection: CaseIterable {
case northern
Expand Down Expand Up @@ -157,7 +156,6 @@ struct DynamicStylingExample: View {
}
}

@available(iOS 13.0, *)
struct ConnectionComponent: MapStyleContent {
enum Kind: String, CaseIterable {
case line
Expand Down Expand Up @@ -203,7 +201,6 @@ struct ConnectionComponent: MapStyleContent {
}

/// Implements the route line component
@available(iOS 13.0, *)
struct RouteLine: MapStyleContent {
var id: String
var featureRef: FeaturesRef
Expand Down Expand Up @@ -236,7 +233,6 @@ struct RouteLine: MapStyleContent {
}

/// Implements a GeoJSON source that is updated when the reference to features is changed.
@available(iOS 13.0, *)
struct LazyGeoJSON: MapStyleContent {
let id: String
let features: FeaturesRef
Expand All @@ -254,7 +250,6 @@ class FeaturesRef {
init(_ features: [Feature]) { self.features = features }
}

@available(iOS 13.0, *)
struct ModelsComponent: MapStyleContent {
var body: some MapStyleContent {
/// Add models
Expand Down Expand Up @@ -292,7 +287,6 @@ struct ModelsComponent: MapStyleContent {
}
}

@available(iOS 14.0, *)
extension DynamicStylingExample.CityCollection {
var pinFeatures: FeaturesRef {
switch self {
Expand Down Expand Up @@ -321,7 +315,6 @@ extension DynamicStylingExample.CityCollection {
}
}

@available(iOS 13.0, *)
private struct RadioButtonSettingView<Value>: View
where Value: CaseIterable, Value: Hashable, Value.AllCases: RandomAccessCollection {
var title: String
Expand All @@ -339,7 +332,6 @@ where Value: CaseIterable, Value: Hashable, Value.AllCases: RandomAccessCollecti
}
}

@available(iOS 13.0, *)
private extension Viewport {
static var exampleOverview: Viewport = .camera(center: .init(latitude: 46.80, longitude: 11.18), zoom: 3, pitch: 45)
static var modelsOverview: Viewport = .camera(center: .init(latitude: 60.172, longitude: 24.94), zoom: 13.32, pitch: 45)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import SwiftUI
import MapboxMaps

/// This example shows how to use `MapReader` in order to access underlying `MapboxMap` API in SwiftUI.
@available(iOS 14.0, *)
struct FeaturesQueryExample: View {
@StateObject private var model = Model()
var body: some View {
Expand Down Expand Up @@ -32,7 +31,6 @@ struct FeaturesQueryExample: View {
}
}

@available(iOS 14.0, *)
private class Model: ObservableObject {
struct Location: Identifiable {
var id = UUID()
Expand Down Expand Up @@ -73,7 +71,6 @@ private class Model: ObservableObject {
}
}

@available(iOS 14.0, *)
struct QueryResult: Identifiable {
struct Feature: Identifiable {
var id = UUID()
Expand Down Expand Up @@ -105,7 +102,6 @@ struct QueryResult: Identifiable {
}
}

@available(iOS 14.0, *)
struct ResultView: View {
let result: QueryResult
var body: some View {
Expand All @@ -125,7 +121,6 @@ struct ResultView: View {
}
}

@available(iOS 14.0, *)
struct FeaturesQueryExample_Preview: PreviewProvider {
static var previews: some View {
FeaturesQueryExample()
Expand Down
Loading

0 comments on commit b8180c2

Please sign in to comment.