<!--
{
  "availability" : [
    "macOS: 10.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "InputMethodKit",
  "identifier" : "/documentation/InputMethodKit/IMKCandidates/setDismissesAutomatically(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "InputMethodKit"
    ],
    "preciseIdentifier" : "c:objc(cs)IMKCandidates(im)setDismissesAutomatically:"
  },
  "title" : "setDismissesAutomatically(_:)"
}
-->

# setDismissesAutomatically(_:)

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

```
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

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 <doc://com.apple.documentation/documentation/Swift/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 <doc://com.apple.documentation/documentation/Swift/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.

---

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)