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
 }

```
Swift 5+

Very easy and Smooth way

```
//MARK: - Usage
let path = self.bezierPath(from: CLLocationCoordinate2D(latitude: kLatitude, longitude: kLongtitude), to: CLLocationCoordinate2D(latitude: self.restaurantLat, longitude: self.restaurantLong))

  let polyline = GMSPolyline(path: path)
  polyline.strokeWidth = 5.0
  polyline.strokeColor = appClr
  polyline.map = self.googleMapView // Google MapView

```

Simple Function

```
func drawArcPolyline(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
 }

```

[![enter image description here](https://i.stack.imgur.com/uAdgW.jpg)](https://i.stack.imgur.com/uAdgW.jpg)