When specific advanced marker properties are set, you can monitor marker events
such as taps and [gestures](https://developers.google.com/maps/documentation/ios-sdk/controls.md.txt#map_gestures).
If a marker is tapped, one can see additional information such as a marker title
or snippet. One can also move draggable markers using a long press gesture.

- To track marker events, add the [`GMSMapViewDelegate`](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Protocols/GMSMapViewDelegate.md.txt) to your `view`.
- To make a marker draggable, set the [`GMSMarker.draggable`](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSMarker.md.txt#draggable) property.
- To set descriptive text for a marker, use the [`GMSMarker.title`](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSOverlay.md.txt#title) property.

## Respond to marker events

You can respond to [marker events](https://developers.google.com/maps/documentation/ios-sdk/events.md.txt) by adding
the [`GMSMapViewDelegate`](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Protocols/GMSMapViewDelegate.md.txt) protocol to your view and
implementing the corresponding callback. This example identifies the `title` and
`snippet` for a selected marker.

### Swift

```swift
// MARK: GMSMapViewDelegate

func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {
  if let title = marker.title {
    if let snippet = marker.snippet {
      print("marker title: \(title): snippet: \(snippet)")
    }
  }
  return true
}
```

### Objective-C

```objective-c
// MARK: GMSMapViewDelegate

-   (BOOL)mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)marker {
  if (marker.title && marker.snippet) {
    NSLog(@"marker with title:%@ snippet: %@", marker.title,  marker.snippet)
  }
  return YES;
}
```

## Control marker visibility by map zoom level

To control the visibility of [`GMSMarker`](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Classes/GMSMarker.md.txt), implement the
[`GMSMapViewDelegate`](https://developers.google.com/maps/documentation/ios-sdk/reference/objc/Protocols/GMSMapViewDelegate.md.txt) protocol and add a condition to set
`GMSMarker.map`.

### Swift

```swift
// MARK: GMSMapViewDelegate

func mapView(_ mapView: GMSMapView, didChange position: GMSCameraPosition) {
    marker.map = position.zoom >= 14 ? mapView : nil
}
```

### Objective-C

```objective-c
// MARK: GMSMapViewDelegate

-   (void)mapView:(GMSMapView *)mapView didChangeCameraPosition:(GMSCameraPosition *)position {
  marker.map = position.zoom >= 14 ? mapView : nil;
}
```

## Make a marker draggable

When you enable the `draggable` property users can drag markers on the map with
a long press gesture. To make a marker draggable, set the `GMSMarker.draggable`
property to true.

### Swift

```swift
marker.draggable = true
```

### Objective-C

```objective-c
marker.draggable = YES;
```