Skip to content

Commit

Permalink
Merge pull request #6 from flitsmeister/feature/0.23.1-spm
Browse files Browse the repository at this point in the history
SPM support
  • Loading branch information
MaartenZonneveld authored Jan 26, 2024
2 parents 0314500 + d32a1e2 commit 6eb45db
Show file tree
Hide file tree
Showing 53 changed files with 148 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
5.9
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cartfile.private
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" ~> 3.4
github "AliSoftware/OHHTTPStubs" ~> 6.0
3 changes: 1 addition & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
binary "https://www.mapbox.com/ios-sdk/Mapbox-iOS-SDK.json" "3.7.8"
github "AliSoftware/OHHTTPStubs" "6.1.0"
github "raphaelmor/Polyline" "v5.1.0"
github "raphaelmor/Polyline" "v5.1.0"
50 changes: 0 additions & 50 deletions MapboxDirections.swift.podspec

This file was deleted.

1 change: 1 addition & 0 deletions MapboxDirections/MBAttribute.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import MapboxDirectionsObjc

public typealias AttributeOptions = MBAttributeOptions

Expand Down
2 changes: 2 additions & 0 deletions MapboxDirections/MBDirections.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import CoreLocation

typealias JSONDictionary = [String: Any]

/// Indicates that an error occurred in MapboxDirections.
Expand Down
1 change: 1 addition & 0 deletions MapboxDirections/MBDirectionsOptions.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Foundation
import Polyline
import MapboxDirectionsObjc

/**
A `RouteShapeFormat` indicates the format of a route or match shape in the raw HTTP response.
Expand Down
1 change: 1 addition & 0 deletions MapboxDirections/MBDirectionsResult.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import CoreLocation
import Polyline

/**
Expand Down
1 change: 1 addition & 0 deletions MapboxDirections/MBIntersection.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import CoreLocation

/**
A single cross street along a step.
Expand Down
1 change: 1 addition & 0 deletions MapboxDirections/MBLaneIndication.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import MapboxDirectionsObjc

public typealias LaneIndication = MBLaneIndication

Expand Down
2 changes: 2 additions & 0 deletions MapboxDirections/MBLaneIndicationComponent.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Foundation

/**
A component that represents a lane representation of an instruction.
*/
Expand Down
1 change: 1 addition & 0 deletions MapboxDirections/MBRoadClasses.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import MapboxDirectionsObjc

public typealias RoadClasses = MBRoadClasses

Expand Down
1 change: 1 addition & 0 deletions MapboxDirections/MBRoute.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import CoreLocation
import Polyline

/**
Expand Down
2 changes: 2 additions & 0 deletions MapboxDirections/MBRouteLeg.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import CoreLocation
import Polyline
import MapboxDirectionsObjc

/**
A `RouteLeg` object defines a single leg of a route between two waypoints. If the overall route has only two waypoints, it has a single `RouteLeg` object that covers the entire route. The route leg object includes information about the leg, such as its name, distance, and expected travel time. Depending on the criteria used to calculate the route, the route leg object may also include detailed turn-by-turn instructions.
Expand Down
3 changes: 3 additions & 0 deletions MapboxDirections/MBRouteOptions.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import CoreLocation
import MapboxDirectionsObjc

/**
A `RouteOptions` object is a structure that specifies the criteria for results returned by the Mapbox Directions API.

Expand Down
2 changes: 2 additions & 0 deletions MapboxDirections/MBRouteStep.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import CoreLocation
import Polyline
import MapboxDirectionsObjc

/**
A `TransportType` specifies the mode of transportation used for part of a route.
Expand Down
2 changes: 1 addition & 1 deletion MapboxDirections/MBSpokenInstruction.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Foundation
import CoreLocation

/**
An instruction about an upcoming `RouteStep`’s maneuver, optimized for speech synthesis.
Expand Down
1 change: 1 addition & 0 deletions MapboxDirections/MBVisualInstruction.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import CoreLocation

/**
The contents of a banner that should be displayed as added visual guidance for a route. The banner instructions are children of the steps during which they should be displayed, but they refer to the maneuver in the following step.
Expand Down
2 changes: 1 addition & 1 deletion MapboxDirections/MBVisualInstructionBanner.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Foundation
import CoreLocation

/**
A visual instruction banner contains all the information necessary for creating a visual cue about a given `RouteStep`.
Expand Down
2 changes: 2 additions & 0 deletions MapboxDirections/MBWaypoint.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import CoreLocation

/**
A `Waypoint` object indicates a location along a route. It may be the route’s origin or destination, or it may be another location that the route visits. A waypoint object indicates the location’s geographic location along with other optional information, such as a name or the user’s direction approaching the waypoint. You create a `RouteOptions` object using waypoint objects and also receive waypoint objects in the completion handler of the `Directions.calculate(_:completionHandler:)` method.
*/
Expand Down
1 change: 1 addition & 0 deletions MapboxDirections/Match/MBMatch.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import CoreLocation
import Polyline

/**
Expand Down
1 change: 1 addition & 0 deletions MapboxDirections/Match/MBMatchOptions.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import MapboxDirectionsObjc

/**
A `MatchOptions` object is a structure that specifies the criteria for results returned by the Mapbox Map Matching API.
Expand Down
3 changes: 2 additions & 1 deletion MapboxDirections/Match/MBTracepoint.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import CoreLocation

/**
A `Tracepoint` represents a location matched to the road network.
*/
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FOUNDATION_EXPORT double MapboxDirectionsVersionNumber;
//! Project version string for MapboxDirections.
FOUNDATION_EXPORT const unsigned char MapboxDirectionsVersionString[];

#import "MBLaneIndication.h"
#import "MBAttribute.h"
#import "MBRouteOptions.h"
#import "MBRoadClasses.h"
#import "../MBLaneIndication.h"
#import "../MBAttribute.h"
#import "../MBRouteOptions.h"
#import "../MBRoadClasses.h"
8 changes: 5 additions & 3 deletions MapboxDirectionsTests/AnnotationTests.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import XCTest
import CoreLocation
import OHHTTPStubs
import OHHTTPStubsSwift
@testable import MapboxDirections

class AnnotationTests: XCTestCase {
override func tearDown() {
OHHTTPStubs.removeAllStubs()
HTTPStubs.removeAllStubs()
super.tearDown()
}

Expand All @@ -23,8 +25,8 @@ class AnnotationTests: XCTestCase {

stub(condition: isHost("api.mapbox.com")
&& containsQueryParams(queryParams)) { _ in
let path = Bundle(for: type(of: self)).path(forResource: "annotation", ofType: "json")
return OHHTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
let path = Bundle.module.path(forResource: "annotation", ofType: "json")
return HTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
}

let options = RouteOptions(coordinates: [
Expand Down
2 changes: 1 addition & 1 deletion MapboxDirectionsTests/DirectionsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DirectionsTests: XCTestCase {
}

override func tearDown() {
OHHTTPStubs.removeAllStubs()
HTTPStubs.removeAllStubs()
super.tearDown()
}

Expand Down
16 changes: 9 additions & 7 deletions MapboxDirectionsTests/IntructionsTests.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import XCTest
import CoreLocation
import OHHTTPStubs
import OHHTTPStubsSwift
@testable import MapboxDirections

class SpokenInstructionsTests: XCTestCase {
override func tearDown() {
OHHTTPStubs.removeAllStubs()
HTTPStubs.removeAllStubs()
super.tearDown()
}

Expand All @@ -26,8 +28,8 @@ class SpokenInstructionsTests: XCTestCase {

stub(condition: isHost("api.mapbox.com")
&& containsQueryParams(queryParams)) { _ in
let path = Bundle(for: type(of: self)).path(forResource: "instructions", ofType: "json")
return OHHTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
let path = Bundle.module.path(forResource: "instructions", ofType: "json")
return HTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
}

let startWaypoint = Waypoint(location: CLLocation(latitude: 37.780602, longitude: -122.431373), heading: nil, name: "the hotel")
Expand Down Expand Up @@ -114,8 +116,8 @@ class SpokenInstructionsTests: XCTestCase {
]

stub(condition: isHost("api.mapbox.com") && containsQueryParams(queryParams)) { _ in
let path = Bundle(for: type(of: self)).path(forResource: "subLaneInstructions", ofType: "json")
return OHHTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
let path = Bundle.module.path(forResource: "subLaneInstructions", ofType: "json")
return HTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
}

let startWaypoint = Waypoint(coordinate: CLLocationCoordinate2D(latitude: 39.132063, longitude: -84.531074))
Expand Down Expand Up @@ -181,8 +183,8 @@ class SpokenInstructionsTests: XCTestCase {
]

stub(condition: isHost("api.mapbox.com") && containsQueryParams(queryParams)) { _ in
let path = Bundle(for: type(of: self)).path(forResource: "subVisualInstructions", ofType: "json")
return OHHTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
let path = Bundle.module.path(forResource: "subVisualInstructions", ofType: "json")
return HTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
}

let startWaypoint = Waypoint(coordinate: CLLocationCoordinate2D(latitude: 37.775469, longitude: -122.449158))
Expand Down
12 changes: 7 additions & 5 deletions MapboxDirectionsTests/MatchTests.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import XCTest
import CoreLocation
import OHHTTPStubs
import OHHTTPStubsSwift
@testable import MapboxDirections

class MatchTests: XCTestCase {
override func tearDown() {
OHHTTPStubs.removeAllStubs()
HTTPStubs.removeAllStubs()
super.tearDown()
}

Expand All @@ -21,8 +23,8 @@ class MatchTests: XCTestCase {
stub(condition: isHost("api.mapbox.com")
&& isMethodPOST()
&& isPath("/matching/v5/mapbox/driving")) { _ in
let path = Bundle(for: type(of: self)).path(forResource: "match", ofType: "json")
return OHHTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
let path = Bundle.module.path(forResource: "match", ofType: "json")
return HTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
}

var match: Match!
Expand Down Expand Up @@ -109,8 +111,8 @@ class MatchTests: XCTestCase {
stub(condition: isHost("api.mapbox.com")
&& isMethodPOST()
&& isPath("/matching/v5/mapbox/driving")) { _ in
let path = Bundle(for: type(of: self)).path(forResource: "null-tracepoint", ofType: "json")
return OHHTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
let path = Bundle.module.path(forResource: "null-tracepoint", ofType: "json")
return HTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
}

var match: Match!
Expand Down
8 changes: 5 additions & 3 deletions MapboxDirectionsTests/RoutableMatchTests.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import XCTest
import CoreLocation
import OHHTTPStubs
import OHHTTPStubsSwift
@testable import MapboxDirections

class RoutableMatchTest: XCTestCase {
override func tearDown() {
OHHTTPStubs.removeAllStubs()
HTTPStubs.removeAllStubs()
super.tearDown()
}

Expand All @@ -21,8 +23,8 @@ class RoutableMatchTest: XCTestCase {
stub(condition: isHost("api.mapbox.com")
&& isMethodPOST()
&& isPath("/matching/v5/mapbox/driving")) { _ in
let path = Bundle(for: type(of: self)).path(forResource: "match", ofType: "json")
return OHHTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
let path = Bundle.module.path(forResource: "match", ofType: "json")
return HTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
}

var route: Route!
Expand Down
3 changes: 2 additions & 1 deletion MapboxDirectionsTests/RouteOptionsTests.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import XCTest
import CoreLocation
@testable import MapboxDirections

class RouteOptionsTests: XCTestCase {
Expand Down Expand Up @@ -50,7 +51,7 @@ class RouteOptionsTests: XCTestCase {


private func response(for fixtureName: String, waypoints: [Waypoint] = testWaypoints) -> (waypoints:[Waypoint], route:Route)? {
let testBundle = Bundle(for: type(of: self))
let testBundle = Bundle.module
guard let fixtureURL = testBundle.url(forResource:fixtureName, withExtension:"json") else { XCTFail(); return nil }
guard let fixtureData = try? Data(contentsOf: fixtureURL, options:.mappedIfSafe) else {XCTFail(); return nil }
guard let fixtureOpaque = try? JSONSerialization.jsonObject(with: fixtureData), let fixture = fixtureOpaque as? JSONDictionary else { XCTFail(); return nil }
Expand Down
1 change: 1 addition & 0 deletions MapboxDirectionsTests/RouteStepTests.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import XCTest
import CoreLocation
@testable import MapboxDirections

class RoadTests: XCTestCase {
Expand Down
8 changes: 5 additions & 3 deletions MapboxDirectionsTests/V4Tests.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import XCTest
import CoreLocation
import OHHTTPStubs
import OHHTTPStubsSwift
@testable import MapboxDirections

class V4Tests: XCTestCase {
override func tearDown() {
OHHTTPStubs.removeAllStubs()
HTTPStubs.removeAllStubs()
super.tearDown()
}

Expand All @@ -21,8 +23,8 @@ class V4Tests: XCTestCase {
stub(condition: isHost("api.mapbox.com")
&& isPath("/v4/directions/mapbox.driving/-122.42,37.78;-77.03,38.91.json")
&& containsQueryParams(queryParams)) { _ in
let path = Bundle(for: type(of: self)).path(forResource: "v4_driving_dc_\(shapeFormat)", ofType: "json")
return OHHTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
let path = Bundle.module.path(forResource: "v4_driving_dc_\(shapeFormat)", ofType: "json")
return HTTPStubsResponse(fileAtPath: path!, statusCode: 200, headers: ["Content-Type": "application/json"])
}

let options = RouteOptionsV4(coordinates: [
Expand Down
Loading

0 comments on commit 6eb45db

Please sign in to comment.