---
title: "selectPreviousKeyView(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nswindow/selectpreviouskeyview(_:)"
---

# selectPreviousKeyView(_:)

Searches for a candidate previous key view and, if it finds one, tries to make it the first responder.

## Declaration

```swift
func selectPreviousKeyView(_ sender: Any?)
```

## Parameters

- `sender`: The message’s sender.

## Discussion

Discussion The candidate is one of the following (which this function searches for in this order): The current first responder’s previous valid key view, which the previousValidKeyView method of NSView returns The initialFirstResponder designates as the window’s initial first responder if it returns true to an acceptsFirstResponder message Otherwise, the initial first responder’s previous valid key view, which may be nil

## See Also

### Managing the Key View Loop

- [selectKeyView(preceding:)](appkit/nswindow/selectkeyview(preceding:).md)
- [selectKeyView(following:)](appkit/nswindow/selectkeyview(following:).md)
- [selectNextKeyView(_:)](appkit/nswindow/selectnextkeyview(_:).md)
- [keyViewSelectionDirection](appkit/nswindow/keyviewselectiondirection.md)
- [autorecalculatesKeyViewLoop](appkit/nswindow/autorecalculateskeyviewloop.md)
- [recalculateKeyViewLoop()](appkit/nswindow/recalculatekeyviewloop().md)
