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

# complete(_:)

Invokes completion in a text view.

```
func complete(_ sender: Any?)
```

## Parameters

`sender`

The control sending the message. May be `nil`.

## Discussion

By default invoked using the F5 key, this method provides users with a choice of completions for the word currently being typed. May be invoked programmatically if autocompletion is desired by a client of the text system. You can change the key invoking this method using the text system’s key bindings mechanism; see “[Text System Defaults and Key Bindings](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/EventOverview/TextDefaultsBindings/TextDefaultsBindings.html#//apple_ref/doc/uid/20000468)” for an explanation of the procedure.

The delegate may replace or modify the list of possible completions by implementing [`textView(_:completions:forPartialWordRange:indexOfSelectedItem:)`](/documentation/AppKit/NSTextViewDelegate/textView(_:completions:forPartialWordRange:indexOfSelectedItem:)). Subclasses can control the list by overriding [`completions(forPartialWordRange:indexOfSelectedItem:)`](/documentation/AppKit/NSTextView/completions(forPartialWordRange:indexOfSelectedItem:)).

---

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)