Skip to content

Instantly share code, notes, and snippets.

@jacks205
Created May 6, 2015 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacks205/1148f423652d6ec4c087 to your computer and use it in GitHub Desktop.
Save jacks205/1148f423652d6ec4c087 to your computer and use it in GitHub Desktop.
Constants for Routes
//
// Constants.swift
// Routes
//
// Created by Mark Jackson on 3/21/15.
// Copyright (c) 2015 Mark Jackson. All rights reserved.
//
struct Constants{
struct SEGUE{
static let MANEUVER = "ManeuverSegue"
static let ADD_ROUTE = "addRoute"
static let END_ROUTE = "endRoute"
static let RECEIPT_ROUTE = "receiptRoute"
}
struct MAPBOX{
static let TOKEN = "pk.eyJ1IjoiamFja3MyMDUiLCJhIjoiRlV5OEtRayJ9.KZHUKl8OnAgmH12xblGaFg"
static let MAP_ID = "jacks205.lmc8ihp6"
}
struct HERE{
//Nokia app id and app code
static let APP_ID = "oqd2moxEVhFbeD6n5zuW"
static let APP_CODE = "T-dTq3eHQCjFOYwx3-KS8A"
struct KEY {
static let DISTANCE = "distance"
static let LENGTH = "length"
static let BASE_TIME = "baseTime"
static let TRAFFIC_TIME = "trafficTime"
static let TRAVEL_TIME = "travelTime"
static let POSITION = "position"
static let INSTRUCTION = "instruction"
static let LATITUDE = "latitude"
static let LONGITUDE = "longitude"
static let RESPONSE = "response"
static let ROUTE = "route"
static let SUMMARY = "summary"
static let LEG = "leg"
static let MANEUVER = "maneuver"
}
struct URL{
struct CALCULATE_ROUTE {
static let DOMAIN = "http://route.cit.api.here.com/routing/7.2/calculateroute.json?"
static let PARAMS = "&instructionformat=text&metricsystem=imperial&alternatives=2&routeAttributes=routeId&mode=fastest;car;traffic:enabled&arrival"
}
struct GET_ROUTE {
static let DOMAIN = "http://route.cit.api.here.com/routing/7.2/getroute.json?"
static let PARAMS_1 = "&instructionformat=text&metricsystem=imperial"
//Separated because a routeId parameter is needed
static let PARAMS_2 = "&mode=fastest;car;traffic:enabled&arrival"
}
}
}
//How to URL Encode string
// CFURLCreateStringByAddingPercentEscapes(nil, str, nil, "!*'();:@&=+$,/?%#[]\" ", kCFStringEncodingASCII)
}
//EX: http://route.cit.api.here.com/routing/7.2/calculateroute.json?app_id=oqd2moxEVhFbeD6n5zuW&app_code=T-dTq3eHQCjFOYwx3-KS8A&waypoint0=geo!33.9011400,-117.7959710&waypoint1=geo!33.9766205,-118.0328637&instructionformat=text&metricsystem=imperial&mode=fastest;car;traffic:enabled&arrival
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment