<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSView/previousValidKeyView",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSView(py)previousValidKeyView"
  },
  "title" : "previousValidKeyView"
}
-->

# previousValidKeyView

The closest view object in the key view loop that precedes the current view and accepts first responder status.

```
unowned(unsafe) var previousValidKeyView: NSView? { get }
```

## Discussion

The value in this property is `nil` if there is no view that precedes the current view and accepts the first responder status. AppKit ignores hidden views when it determines the previous valid key view.

## See Also

[`-  selectKeyViewFollowingView:`](/documentation/AppKit/NSWindow/selectKeyView(following:))

Gives key view status to the view that follows the given view.

[`hidden`](/documentation/AppKit/NSView/isHidden)

A Boolean value indicating whether the view is hidden.

[`-  selectNextKeyView:`](/documentation/AppKit/NSWindow/selectNextKeyView(_:))

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

[`-  selectPreviousKeyView:`](/documentation/AppKit/NSWindow/selectPreviousKeyView(_:))

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

[`-  selectKeyViewPrecedingView:`](/documentation/AppKit/NSWindow/selectKeyView(preceding:))

Gives key view status to the view that precedes the given view.



---

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)