# Advanced Place Details component

> [!NOTE]
> This is a Pro component and is billed differently from the Essentials components. See the [Overview](https://developers.google.com/maps/documentation/places/ios-sdk/places-ui-kit-overview.md.txt) for more information.

The Advanced version of the Place Details component offers the same features as [Places Details Essentials](https://developers.google.com/maps/documentation/places/ios-sdk/place-details-ui-kit.md.txt). It also lets you:

- Choose whether the Place name is displayed.
- Configure the action buttons of the component.
- Apply search and filtering options to the reviews and media that are displayed.
- Create custom content slots.

## Tokens for agentic apps


The agentic data visualization token lets your agentic app display Places UI Kit elements for the places in a Maps Experience agent tools (formerly Maps Grounding Lite) response at no additional cost. For more information, see [Agentic data visualization token](https://developers.google.com/maps/ai/agentic-data-visualization-token.md.txt).

## Advanced Place Details configuration

Use [`AdvancedPlaceDetailsView`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/AdvancedPlaceDetailsView.md.txt) or [`AdvancedPlaceDetailsCompactView`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/AdvancedPlaceDetailsCompactView.md.txt) to access advanced features.

### Content display options

You can specify which content to display using the enums in [`AdvancedPlaceDetailsContent`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Enums/AdvancedPlaceDetailsContent.md.txt). You can configure all of the same content as [Places Details Essentials](https://developers.google.com/maps/documentation/places/ios-sdk/place-details-ui-kit.md.txt#content-display-options), as well as choose whether the Place name is displayed.

### Configure action buttons

Use the `.cornerActions` and `.mainActions` methods of `AdvancedPlaceDetailsView` or `AdvancedPlaceDetailsCompactView` to remove or customize the action buttons.

#### Visual attribution requirements

![Place details compact view with customized buttons](https://developers.google.com/static/maps/documentation/places/images/places-details-compact-custom-button.svg) Advanced Place Details compact view with customized button


**Important:** You must make it clear to end-users when a custom action button will share user information with a third party other than Google. See [visual attribution requirements](https://developers.google.com/maps/documentation/javascript/policies.md.txt#visual-requirements).

The example at the right shows a custom image that makes it clear that user information will be sent to "Altostrat".

### Apply search and filtering options

Use the `.searchMediaOptions` and `.searchReviewOptions` methods of `AdvancedPlaceDetailsView` or `AdvancedPlaceDetailsCompactView` to enable search and filtering for media or reviews.

### Create custom content slots

![Custom content slot placement options](https://developers.google.com/static/maps/images/places-ui-kit/content-slots.png)


Custom content slots allow you to add your own content (such as AI-generated summaries, itinerary timestamps, or custom badges) directly into predefined layout zones.

To add custom content slots, use the `.placeDetailsCompactContentSlot` method of [`AdvancedPlaceDetailsCompactView`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/swift/Structs/AdvancedPlaceDetailsCompactView.md.txt). The available positions are `.basicSectionTop` and `.basicSectionBottom`.

> [!NOTE]
> **Note:** Custom content slots are only supported in `AdvancedPlaceDetailsCompactView`.

#### Attribution requirements and content suggestions for content slots


When a custom content slot is mounted, the disclosure automatically updates to clarify which content is provided by Google and that some content is provided by 3rd parties.

Yes

Maintain a clear visual hierarchy between Google Place details and custom content to prevent any ambiguity about the source of the information.
![Prevent ambiguity about information source](https://developers.google.com/static/maps/images/places-ui-kit/do-01.png)
Yes

Consider localized, high-value insights tailored to your users' immediate goals. Tailored content such as real-time booking windows or current availability helps users make faster, more informed decisions.
![Provide high value insights](https://developers.google.com/static/maps/images/places-ui-kit/do-02.png)
No

Don't duplicate existing Google Place details, such as ratings, reviews, or business hours, even if you have hidden the Google-provided content. Doing so can confuse users about the source of the content and whether it comes from Google or a third party.
![Don't duplicate existing Google Place details](https://developers.google.com/static/maps/images/places-ui-kit/dont-01.png)
No

Don't display unattributed claims or badges (for example, "Top recommendation!") that could be mistaken for official Google endorsements. Custom content must explicitly attribute its source.
![Don't display unattributed claims or badges](https://developers.google.com/static/maps/images/places-ui-kit/dont-02.png)
No

Don't include ads, marketing copy, promotional discounts, or subscription prompts within custom place containers.
![Don't include ads, marketing copy, promotional discounts, or subscription prompts](https://developers.google.com/static/maps/images/places-ui-kit/dont-03.png)

## Advanced Place Details examples

### Omit the Place name

To omit the Place name, don't include `.name` in the `content` parameter of `AdvancedPlaceDetailsConfiguration`.

### Swift

```swift
struct DemoView: View {
  static let peetsCoffeePlaceID = "ChIJT7FdmYiAhYAROFOvrIxRJDU"

  // Query for loading the place details component.
  @State var query: PlaceDetailsQuery = PlaceDetailsQuery(
    identifier: .placeID(peetsCoffeePlaceID)
  )
  @State private var favoritePlaces: Set<String> = []

  var body: some View {
    AdvancedPlaceDetailsView(
      query: $query,
      configuration: AdvancedPlaceDetailsConfiguration(
        content:[.address()],
        theme: PlacesMaterialTheme()
      ),
      placeDetailsCallback: { result in
        if let place = result.place {
          print("Place: \(place.description)")
        } else {
          print("Error: \(String(describing: result.error))")
        }
      }
    )
  }
}
```

### Remove action buttons

### Swift

```swift
struct DemoView: View {
  static let peetsCoffeePlaceID = "ChIJT7FdmYiAhYAROFOvrIxRJDU"

  @State var query: PlaceDetailsQuery = PlaceDetailsQuery(
    identifier: .placeID(peetsCoffeePlaceID)
  )

  var body: some View {
    AdvancedPlaceDetailsView(
      query: $query,
      configuration: AdvancedPlaceDetailsConfiguration(
        content: AdvancedPlaceDetailsView.allContent,
        theme: PlacesMaterialTheme()
      ),
      placeDetailsCallback: { result in
        if let place = result.place {
          print("Place: \(place.description)")
        } else {
          print("Error: \(String(describing: result.error))")
        }
      }
    )
    .mainActions{ _ in
      return []
    }
  }
}
```

### Add custom and predefined actions

This sample adds an option for a user to favorite or unfavorite a place, along with the predefined **Open in Maps** action.

### Swift

```swift
struct DemoView: View {
  static let peetsCoffeePlaceID = "ChIJT7FdmYiAhYAROFOvrIxRJDU"

  @State var query: PlaceDetailsQuery = PlaceDetailsQuery(
    identifier: .placeID(peetsCoffeePlaceID)
  )
  
  @State var favoritePlaces: Set<String> = []

  var body: some View {
    AdvancedPlaceDetailsView(
      query: $query,
      configuration: AdvancedPlaceDetailsConfiguration(
        content: AdvancedPlaceDetailsView.allContent,
        theme: PlacesMaterialTheme()
      ),
      placeDetailsCallback: { result in
        if let place = result.place {
          print("Place: \(place.description)")
        } else {
          print("Error: \(String(describing: result.error))")
        }
      }
    )
    .mainActions{ place in
      var actions: [MainPlaceActionElement] = []
      let placeID = place.placeID!
      if self.favoritePlaces.contains(placeID) {
        actions.append(
          .action(
            MainPlaceAction(
              image: Image(systemName: "heart.fill"),
              label: "Unfavorite"
            ) { _ in self.toggleFavorite(placeID) }
          )
        )
      } else {
        actions.append(
          .action(
            MainPlaceAction(
              image: Image(systemName: "heart"),
              label: "Favorite"
            ) { _ in self.toggleFavorite(placeID) }
          )
        )
      }
      actions.append(.actionId(.openMap(style: .primary)))
      return actions
    }
    .cornerActions { place in
      var actions: [CornerPlaceActionElement] = []
      let placeID = place.placeID!
      if self.favoritePlaces.contains(placeID) {
        actions.append(
          .action(
            CornerPlaceAction(
              image: Image(systemName: "heart.fill"),
              accessibilityLabel: "Unfavorite",
            ) { _ in self.toggleFavorite(placeID) }
          )
        )
      } else {
        actions.append(
          .action(
            CornerPlaceAction(
              image: Image(systemName: "heart"),
              accessibilityLabel: "Favorite",
            ) { _ in self.toggleFavorite(placeID) }
          )
        )
      }
      actions.append(.actionId(.openMap(style: .primary)))
      return actions
    }
  }

  func toggleFavorite(_ placeID: String) {
    if favoritePlaces.contains(placeID) {
      favoritePlaces.remove(placeID)
    } else {
      favoritePlaces.insert(placeID)
    }
  }
}
```

### Filter reviews and media

This code sample shows only media and reviews that mention "coffee".

### Swift

```swift
struct DemoView: View {
  static let peetsCoffeePlaceID = "ChIJT7FdmYiAhYAROFOvrIxRJDU"

  @State var query: PlaceDetailsQuery = PlaceDetailsQuery(
    identifier: .placeID(peetsCoffeePlaceID)
  )
  let searchMediaOptions = SearchMediaOptions(query: "coffee")
  let searchReviewsOptions = SearchReviewsOptions(query: "coffee")

  var body: some View {
    AdvancedPlaceDetailsView(
      query: $query,
      configuration: AdvancedPlaceDetailsConfiguration(
        content: [.media(), .reviews()],
        theme: PlacesMaterialTheme()
      ),
      placeDetailsCallback: { _ in }
    )
    .searchMediaOptions(searchMediaOptions) { results in
      guard let result = results.first else { return }
      switch result {
      case .success(let summary):
        print("Summary: \(summary)")
      case .failure(let error):
        print("Error: \(error)")
      }
    }
    .searchReviewsOptions(searchReviewsOptions) { results in
      guard let result = results.first else { return }
      switch result {
      case .success(let summary):
        print("Summary: \(summary)")
      case .failure(let error):
        print("Error: \(error)")
      }
    }
  }
}
```

### Create content slots

This sample adds content to the `basicSectionTop` and `basicSectionBottom` slots.

### Swift

```swift
import SwiftUI
import PlacesSwift

struct ItineraryCard: View {
    static let peetsCoffeePlaceID = "ChIJT7FdmYiAhYAROFOvrIxRJDU"

    @State var query: PlaceDetailsQuery = PlaceDetailsQuery(
      identifier: .placeID(peetsCoffeePlaceID)
    )

    var body: some View {
      AdvancedPlaceDetailsCompactView(
        orientation: .vertical,
        query: $query,
        configuration: AdvancedPlaceDetailsCompactConfiguration(
          content: AdvancedPlaceDetailsCompactView.allContent,
          theme: PlacesMaterialTheme()
        ),
        placeDetailsCallback: { _ in }
      )
      .placeDetailsCompactContentSlot(position: .basicSectionTop) { place in
        Text("Day 2 • 2:30 PM")
          .font(.caption)
          .fontWeight(.bold)
          .foregroundColor(.accentColor)
      }
      .placeDetailsCompactContentSlot(position: .basicSectionBottom) { place in
        VStack(alignment: .leading, spacing: 4) {
          Text("AI Notes")
            .font(.caption)
            .bold()
          Text("Great quiet atmosphere for morning meetings. Famous for house-roasted pour-overs.")
            .font(.footnote)
            .foregroundColor(.secondary)
        }
        .padding(8)
        .background(Color(.systemGray6))
        .cornerRadius(8)
      }
    }
}
```