---
title: "presentAsModalWindow(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsviewcontroller/presentasmodalwindow(_:)"
---

# presentAsModalWindow(_:)

Presents another view controller as a modal window, also known as an alert.

## Declaration

```swift
func presentAsModalWindow(_ viewController: NSViewController)
```

## Parameters

- `viewController`: The other view controller to present as a modal window.

## Discussion

Discussion This method calls the present(_:animator:) method on self (the presenting view controller), and passes a modal window animator to that method. The presented view controller is the delegate and the content view controller of its window. You can use NSWindowDelegate methods to prevent the closing of the modal window, if needed. To dismiss the modal window, call the dismiss(_:) method on self (the presenting view controller).

## See Also

### Presenting Another View Controller’s Content

- [present(_:animator:)](appkit/nsviewcontroller/present(_:animator:).md)
- [dismiss(_:)](appkit/nsviewcontroller/dismiss(_:)-91my5.md)
- [present(_:asPopoverRelativeTo:of:preferredEdge:behavior:)](appkit/nsviewcontroller/present(_:aspopoverrelativeto:of:preferrededge:behavior:).md)
- [present(_:asPopoverRelativeTo:of:preferredEdge:behavior:hasFullSizeContent:)](appkit/nsviewcontroller/present(_:aspopoverrelativeto:of:preferrededge:behavior:hasfullsizecontent:).md)
- [presentAsSheet(_:)](appkit/nsviewcontroller/presentassheet(_:).md)
- [present(inWidget:)](appkit/nsviewcontroller/present(inwidget:).md)
