Question: I have been having trouble passing a dictionary from a list into another function. I am pretty sure it is because my dictionary is in a list of dictionaries.

Example:

what i want is: `{"part": x2f5, "color": red, "amount": 10}`

What I am getting when I am passing to the function: `[{part": x2f5, "color": red, "amount": 10}]`

```
if (len(order["inventory"]) >= 1):
    #I want to double check here if the part is already in the order 
    if new_order["part"] in (i["part"] for i in order["inventory"]):
        if already_in(new_order, order["inventory"]): 

```

Let me know if I should add more information.

Answer: 
I used Bezier quadratic equation to draw curved lines. [You can have a look on to the implementation](https://github.com/shossain2806/GoogleMapSample). Here is the sample code.

```
func bezierPath(from startLocation: CLLocationCoordinate2D, to endLocation: CLLocationCoordinate2D) -> GMSMutablePath {

        let distance = GMSGeometryDistance(startLocation, endLocation)
        let midPoint = GMSGeometryInterpolate(startLocation, endLocation, 0.5)

        let midToStartLocHeading = GMSGeometryHeading(midPoint, startLocation)

        let controlPointAngle = 360.0 - (90.0 - midToStartLocHeading)
        let controlPoint = GMSGeometryOffset(midPoint, distance / 2.0 , controlPointAngle)

        let path = GMSMutablePath()

        let stepper = 0.05
        let range = stride(from: 0.0, through: 1.0, by: stepper)// t = [0,1]

        func calculatePoint(when t: Double) -> CLLocationCoordinate2D {
            let t1 = (1.0 - t)
            let latitude = t1 * t1 * startLocation.latitude + 2 * t1 * t * controlPoint.latitude + t * t * endLocation.latitude
            let longitude = t1 * t1 * startLocation.longitude + 2 * t1 * t * controlPoint.longitude + t * t * endLocation.longitude
            let point = CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
            return point
        }

        range.map { calculatePoint(when: $0) }.forEach { path.add($0) }
        return path
 }

```
Objective-C version @Rouny answer

```
- (void)DrawCurvedPolylineOnMapFrom:(CLLocationCoordinate2D)startLocation To:(CLLocationCoordinate2D)endLocation
{
    GMSMutablePath * path = [[GMSMutablePath alloc]init];
    [path addCoordinate:startLocation];
    [path addCoordinate:endLocation];
    // Curve Line
    double k = 0.2; //try between 0.5 to 0.2 for better results that suits you
    CLLocationDistance d = GMSGeometryDistance(startLocation, endLocation);
    float h = GMSGeometryHeading(startLocation , endLocation);

    //Midpoint position
    CLLocationCoordinate2D p = GMSGeometryOffset(startLocation, d * 0.5, h);
    //Apply some mathematics to calculate position of the circle center
    float x = (1-k*k)*d*0.5/(2*k);
    float r = (1+k*k)*d*0.5/(2*k);
    CLLocationCoordinate2D c = GMSGeometryOffset(p, x, h + -90.0);

    //Polyline options
    //Calculate heading between circle center and two points
    float h1 =  GMSGeometryHeading(c, startLocation);
    float h2 = GMSGeometryHeading(c, endLocation);
    //Calculate positions of points on circle border and add them to polyline options
    float numpoints = 100;
    float step = ((h2 - h1) / numpoints);
    for (int i = 0; i < numpoints; i++) {
        CLLocationCoordinate2D pi = GMSGeometryOffset(c, r, h1 + i * step);
        [path addCoordinate:pi];
    }

    //Draw polyline
    GMSPolyline * polyline = [GMSPolyline polylineWithPath:path];
    polyline.map = mapView;
    polyline.strokeWidth = 3.0;
    NSArray *styles = @[[GMSStrokeStyle solidColor:kBaseColor],
                        [GMSStrokeStyle solidColor:[UIColor clearColor]]];

    NSArray *lengths = @[@5, @5];

    polyline.spans = GMSStyleSpans(polyline.path, styles, lengths, kGMSLengthRhumb);

    GMSCoordinateBounds * bounds = [[GMSCoordinateBounds alloc]initWithCoordinate:startLocation coordinate:endLocation];
    UIEdgeInsets insets = UIEdgeInsetsMake(20, 20, 20, 20);
    GMSCameraPosition * camera = [mapView cameraForBounds:bounds insets:insets ];
    [mapView animateToCameraPosition:camera];

}

```