---
title: "setDismissesAutomatically(_:)"
framework: InputMethodKit
role: symbol
role_heading: Instance Method
platforms: [macOS 10.5+]
path: "inputmethodkit/imkcandidates/setdismissesautomatically(_:)"
---

# setDismissesAutomatically(_:)

Sets the state of the flag that determines whether the candidates window dismisses automatically.

## Declaration

```swift
func setDismissesAutomatically(_ flag: Bool)
```

## Parameters

- `flag`: doc://com.apple.documentation/documentation/Swift/true to have the candidates window dismiss automatically; otherwise doc://com.apple.documentation/documentation/Swift/false.

## Discussion

Discussion By default, if the user presses the Return or Enter keys, the candidates are dismissed and a candidateSelected: message is sent to the input controller. You can call the setDismissesAutomatically: method, passing false as the flag parameter to change the default dismissal behavior. The input controller still receives a candidatesSelected: message. When you set the flag to false, an input method processes text input while dynamically updating the content of the candidates as the user inputs text. When a session deactivates, candidate window is hidden regardless of the state of the flag.

## See Also

### Managing Window Visibility and Behavior

- [show(_:)](inputmethodkit/imkcandidates/show(_:).md)
- [hide()](inputmethodkit/imkcandidates/hide().md)
- [isVisible()](inputmethodkit/imkcandidates/isvisible().md)
- [dismissesAutomatically()](inputmethodkit/imkcandidates/dismissesautomatically().md)
- [update()](inputmethodkit/imkcandidates/update().md)
