     
     var coordinate: CLLocationCoordinate2D?
     
-    
+    var droppedPin : Pin!
     let delegate = UIApplication.shared.delegate as! AppDelegate
     var isDeletePin = false
     var fetchedResultsController : NSFetchedResultsController<NSFetchRequestResult>?{

    func handleLongPress(_ gestureReconizer: UILongPressGestureRecognizer) {
        
        if !isDeletePin{
            if gestureReconizer.state != UIGestureRecognizerState.ended {
                return
            }
        
            let location = gestureReconizer.location(in: self.mapView)
            let coordinate = mapView.convert(location, toCoordinateFrom: mapView)
        
            let _ = Pin(latitude: coordinate.latitude, longitude: coordinate.longitude, context: self.fetchedResultsController!.managedObjectContext)
        }
    }
}

    
    @IBAction func editPressed(_ sender: Any) {
        
        if !isDeletePin{
            UIView.animate(withDuration: 0.2, animations: {
                self.mapView.frame.origin.y -= self.editLabel.frame.height
                self.editLabel.frame.origin.y -= self.editLabel.frame.height
                self.isDeletePin = true
                self.editButton.title = "Done"
            })
        }else{
            UIView.animate(withDuration: 0.2, animations: {
                self.mapView.frame.origin.y += self.editLabel.frame.height
                self.editLabel.frame.origin.y += self.editLabel.frame.height
                self.isDeletePin = false
                self.editButton.title = "Edit"
            })
        }
    }
}

//MARK: TravelLocationsViewController: (MKMapViewDelegate)

