Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Swift 3 #64

Merged
merged 44 commits into from
Feb 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
f958f19
Convert example to swift 3
aataraxiaa Aug 2, 2016
938ac99
Run Swift 3 migration on directions framework
aataraxiaa Aug 2, 2016
2b77591
Update directions target SWIFT_VERSION and test targets
aataraxiaa Aug 2, 2016
41849aa
Integrate with forked poly line
aataraxiaa Aug 5, 2016
af8d13e
Update pod dependencies
aataraxiaa Aug 10, 2016
cf47987
Update carthage reference
aataraxiaa Aug 10, 2016
7061c04
Beta 6 updates
aataraxiaa Aug 17, 2016
c1064dd
Remove additional space
aataraxiaa Aug 17, 2016
fdeb38d
Update readme
aataraxiaa Sep 9, 2016
5a021d5
Run Xcode GM Swift conversion
aataraxiaa Sep 10, 2016
17f6db9
bumped Poyline dep
frederoni Sep 27, 2016
cd0be5c
Merge pull request #73 from mapbox/fred-swift3-bump-polyline
frederoni Sep 27, 2016
9fa9f50
Set SWIFT_VERSION in xcconfig
frederoni Sep 28, 2016
3783a1f
Use official Polyline
1ec5 Sep 29, 2016
67b8a95
Merge branch 'master' into swift3
1ec5 Nov 8, 2016
4ffebb2
Removed extraneous Objective-C helper property
1ec5 Nov 8, 2016
7aa2d94
Error domains are just strings in the latest SDK
1ec5 Nov 8, 2016
af29229
Replaced NSIndexSet with IndexSet
1ec5 Nov 8, 2016
6d3744d
Merge branch 'master' into swift3
1ec5 Nov 8, 2016
772cd07
Merge branch 'master' into swift3
1ec5 Nov 9, 2016
117f155
Removed extraneous LaneIndication references
1ec5 Nov 9, 2016
b70d2fe
Merge branch 'master' into swift3
1ec5 Nov 16, 2016
252986e
Replaced CocoaPods with Carthage for managing the subproject
simonseyer Nov 16, 2016
ceaf58b
Merge branch 'master' into swift3
freenerd Nov 17, 2016
8892557
Separated example and framework project
simonseyer Nov 17, 2016
3148854
Updated README
simonseyer Nov 17, 2016
f61c168
Merge remote-tracking branch 'upstream/swift3' into carthage-integration
simonseyer Nov 17, 2016
0dd9933
Removed access token
simonseyer Dec 6, 2016
157f26c
Removed another access token...
simonseyer Dec 6, 2016
0c20ad0
Shared example schemes
simonseyer Dec 6, 2016
4a3990a
Added test targets to example project
simonseyer Dec 6, 2016
e77d41f
Added dummy tests to prevent failure when loading the test bundle
simonseyer Dec 7, 2016
f4aa1b5
Removed spaces from product names
simonseyer Dec 7, 2016
f0a4404
Integrated test targets with Cocoapods
simonseyer Dec 7, 2016
fe7d1b8
Embed Swift libraries for test target
simonseyer Dec 7, 2016
e4a447e
Fixed warning because of missing folder path
simonseyer Dec 7, 2016
d14b9c8
Let tests run in release mode to prevent asserts from crashing the tests
simonseyer Dec 7, 2016
bdc07a5
Merge pull request #102 from mapbox/carthage-integration
Dec 9, 2016
581f246
Merge branch 'master' into swift3
Dec 9, 2016
f3d2997
Merge branch 'master' into swift3
1ec5 Feb 19, 2017
221e451
Link watchOS framework to Polyline
1ec5 Feb 19, 2017
fe2f0a0
Merge branch 'master' into swift3
1ec5 Feb 20, 2017
c1e1c6b
Corrected references to enum values
1ec5 Feb 20, 2017
0db7bab
Updated readme
1ec5 Feb 20, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ xcuserdata
*.xcscmblueprint

Pods/

Carthage/Build
Carthage/Checkouts
1 change: 1 addition & 0 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github "raphaelmor/Polyline" "f86f34dac9aae7e027fd9f62c2e01dd77f1ee312"
1 change: 1 addition & 0 deletions Cartfile.private
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github "AliSoftware/OHHTTPStubs" "swift-3.0"
2 changes: 2 additions & 0 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github "AliSoftware/OHHTTPStubs" "57feceaabf333e72b2c637dfba6c13a7a5c49619"
github "raphaelmor/Polyline" "f86f34dac9aae7e027fd9f62c2e01dd77f1ee312"
39 changes: 39 additions & 0 deletions Example/Directions Example Tests/DummyTest.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// DummyTest.m
// DirectionsExample
//
// Created by Simon Seyer on 07/12/2016.
// Copyright © 2016 Mapbox. All rights reserved.
//

#import <XCTest/XCTest.h>

@interface DummyTest : XCTestCase

@end

@implementation DummyTest

- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}

- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}

- (void)testExample {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}

- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}

@end
35 changes: 35 additions & 0 deletions Example/Directions Example Tests/DummyTest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// DummyTest.swift
// DirectionsExample
//
// Created by Simon Seyer on 07/12/2016.
// Copyright © 2016 Mapbox. All rights reserved.
//

import XCTest

class DummyTest: XCTestCase {

override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
}

override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}

func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}

func testPerformanceExample() {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import UIKit
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
window = UIWindow(frame: UIScreen.mainScreen().bounds)
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window!.rootViewController = ViewController(nibName: nil, bundle: nil)
window!.makeKeyAndVisible()

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ class ViewController: UIViewController {
MGLAccountManager.setAccessToken(MapboxAccessToken)

mapView = MGLMapView(frame: view.bounds)
mapView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(mapView)
}

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

let options = RouteOptions(waypoints: [
Expand All @@ -30,28 +30,28 @@ class ViewController: UIViewController {
])
options.includesSteps = true

Directions(accessToken: MapboxAccessToken).calculateDirections(options: options) { (waypoints, routes, error) in
_ = Directions(accessToken: MapboxAccessToken).calculate(options) { (waypoints, routes, error) in
guard error == nil else {
print("Error calculating directions: \(error!)")
return
}

if let route = routes?.first, leg = route.legs.first {
if let route = routes?.first, let leg = route.legs.first {
print("Route via \(leg):")

let distanceFormatter = NSLengthFormatter()
let formattedDistance = distanceFormatter.stringFromMeters(route.distance)
let distanceFormatter = LengthFormatter()
let formattedDistance = distanceFormatter.string(fromMeters: route.distance)

let travelTimeFormatter = NSDateComponentsFormatter()
travelTimeFormatter.unitsStyle = .Short
let formattedTravelTime = travelTimeFormatter.stringFromTimeInterval(route.expectedTravelTime)
let travelTimeFormatter = DateComponentsFormatter()
travelTimeFormatter.unitsStyle = .short
let formattedTravelTime = travelTimeFormatter.string(from: route.expectedTravelTime)

print("Distance: \(formattedDistance); ETA: \(formattedTravelTime!)")

for step in leg.steps {
print("\(step.instructions)")
if step.distance > 0 {
let formattedDistance = distanceFormatter.stringFromMeters(step.distance)
let formattedDistance = distanceFormatter.string(fromMeters: step.distance)
print("— \(formattedDistance) —")
}
}
Expand All @@ -63,7 +63,7 @@ class ViewController: UIViewController {

// Add the polyline to the map and fit the viewport to the polyline.
self.mapView.addAnnotation(routeLine)
self.mapView.setVisibleCoordinates(&routeCoordinates, count: route.coordinateCount, edgePadding: UIEdgeInsetsZero, animated: true)
self.mapView.setVisibleCoordinates(&routeCoordinates, count: route.coordinateCount, edgePadding: .zero, animated: true)
}
}
}
Expand Down
File renamed without changes.
Loading