<!--
{
  "availability" : [
    "macOS: 10.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SecurityInterface",
  "identifier" : "/documentation/SecurityInterface/SFCertificateTrustPanel/beginSheet(for:modalDelegate:didEnd:contextInfo:trust:message:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Security Interface"
    ],
    "preciseIdentifier" : "c:objc(cs)SFCertificateTrustPanel(im)beginSheetForWindow:modalDelegate:didEndSelector:contextInfo:trust:message:"
  },
  "title" : "beginSheet(for:modalDelegate:didEnd:contextInfo:trust:message:)"
}
-->

# beginSheet(for:modalDelegate:didEnd:contextInfo:trust:message:)

Displays a modal sheet that shows the results of a certificate trust evaluation and that allows the user to edit trust settings.

```
func beginSheet(for docWindow: NSWindow!, modalDelegate delegate: Any!, didEnd didEndSelector: Selector!, contextInfo: UnsafeMutableRawPointer!, trust: SecTrust!, message: String!)
```

## Parameters

`docWindow`

The parent window to which the sheet is attached.

`delegate`

The delegate object in which the method specified in the `didEndSelector` parameter is implemented.

`didEndSelector`

A method selector for a delegate method called when the sheet has been dismissed. Implementation of this delegate method is optional.

`contextInfo`

A pointer to data that is passed to the delegate method. You can use this data pointer for any purpose you wish.

`trust`

A trust management object. Use the <doc://com.apple.documentation/documentation/Security/SecTrustCreateWithCertificates(_:_:_:)> function (in Security/SecTrust.h) to create the trust management object.

`message`

A message string to display in the sheet.

## Discussion

The delegate method has the following signature:

```objc
- (void)createPanelDidEnd:(NSWindow *)sheet
        returnCode:(int)returnCode
        contextInfo:(void *)contextInfo
```

The parameters for the delegate method are:

- `sheet`: The window to which the sheet was attached.
- `returnCode`: The result code indicating which button the user clicked: either <doc://com.apple.documentation/documentation/AppKit/NSFileHandlingPanelOKButton> or <doc://com.apple.documentation/documentation/AppKit/NSFileHandlingPanelCancelButton>.
- `contextInfo`: Client-defined contextual data that is passed in the `contextInfo` parameter of the `beginSheetForWindow:...` method.

The delegate method may dismiss the keychain settings sheet itself; if it does not, the sheet is dismissed on return from the `beginSheetForWindow:...` method.

## See Also

  <doc://com.apple.documentation/documentation/Security/SecTrustGetResult>

  <doc://com.apple.documentation/documentation/Security/SecTrustCreateWithCertificates(_:_:_:)>

[`func runModal(for: SecTrust!, message: String!) -> Int`](/documentation/SecurityInterface/SFCertificateTrustPanel/runModal(for:message:))

Displays a modal panel that shows the results of a certificate trust evaluation and that allows the user to edit trust settings.



---

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)