<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: -",
    "tvOS: 17.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIContextMenuConfiguration/init(identifier:previewProvider:actionProvider:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "s:So26UIContextMenuConfigurationC5UIKitE10identifier15previewProvider06actionG0ABSo9NSCopying_pSg_So16UIViewControllerCSgycSgSo6UIMenuCSgSaySo0L7ElementCGcSgtcfc"
  },
  "title" : "init(identifier:previewProvider:actionProvider:)"
}
-->

# init(identifier:previewProvider:actionProvider:)

Creates a menu configuration object with the specified action and preview providers.

```
@MainActor @preconcurrency convenience init(identifier: (any NSCopying)? = nil, previewProvider: UIContextMenuContentPreviewProvider? = nil, actionProvider: UIContextMenuActionProvider? = nil)
```

## Parameters

`identifier`

A unique identifier for the menu configuration object. If you want this method to generate a unique identifier for you, specify `nil`.

`previewProvider`

An optional block that returns the custom view controller that you use to preview content. If you specify `nil`, UIKit uses a default preview view controller.

`actionProvider`

An optional block that provides a contextual menu to display with the preview. If you specify `nil`, UIKit doesn’t display a contextual menu with the previewed content.

## Return Value

A new menu configuration object with the specified provider blocks.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)