MapQuest iOS SDK

Add Traffic to a Map

iOS with Traffic Enabled
@import Mapbox;
@import MapQuestMaps;

@interface ViewController() <MGLMapViewDelegate>

@property (nonatomic, weak) IBOutlet MQMapView *mapView;

@end

@implementation ViewController

-(void)viewDidLoad {
    self.mapView.mapType = MQMapTypeNormal;

    //center map on MapQuest HQ
    CLLocationCoordinate2D MAPQUEST_HQ_LOCATION = CLLocationCoordinate2DMake(39.750307, -104.999472);
    [self.mapView setCenterCoordinate:MAPQUEST_HQ_LOCATION zoomLevel:11 animated:YES];
        
    //set flags to indicate what you want to see on the map
    self.mapView.shouldShowTrafficIncidents = YES;
    self.mapView.shouldShowTrafficFlows = YES;
    self.mapView.shouldShowTrafficCameras = NO;
    
    //enable traffic
    self.mapView.trafficEnabled = YES;
}
@end
import MapQuestMaps
import Mapbox

class ViewController: UIViewController, MGLMapViewDelegate, UIActionSheetDelegate {

    @IBOutlet fileprivate weak var mapView: MQMapView?

    override func viewDidLoad() {
        //center map on MapQuest HQ
        let MAPQUEST_HQ_LOCATION = CLLocationCoordinate2D(latitude: 39.750307, longitude: -104.999472)
        mapView?.setCenter(MAPQUEST_HQ_LOCATION, zoomLevel: 11, animated: true)

        //set flags to indicate what you want to see on the map
        mapView?.shouldShowTrafficFlows = true
        mapView?.shouldShowTrafficCameras = false
        mapView?.shouldShowTrafficIncidents = true

        //enable traffic
        mapView?.trafficEnabled = true
     }
}