<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICollectionView/remembersLastFocusedIndexPath",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UICollectionView(py)remembersLastFocusedIndexPath"
  },
  "title" : "remembersLastFocusedIndexPath"
}
-->

# remembersLastFocusedIndexPath

A Boolean value that indicates whether the collection view automatically assigns the focus to the item at the last focused index path.

```
var remembersLastFocusedIndexPath: Bool { get set }
```

## Discussion

When this property is set to <doc://com.apple.documentation/documentation/Swift/true>, the collection view remembers which index path was focused when focus leaves the collection view. When it receives the focus again, the collection view automatically redirects that focus back to the previously focused index path. The default value of this property is <doc://com.apple.documentation/documentation/Swift/false>.

The effects of this property may be ignored during or immediately after a view controller transition, such as a presentation dismissal or navigation stack pop. In such cases, the view controller attempts to restore focus to the item that was focused prior to the transition (for example, prior to the view controller being presented or pushed), which can take precedence over the effects of this property. To learn how to control or disable this behavior in the view controller, see [`restoresFocusAfterTransition`](/documentation/UIKit/UIViewController/restoresFocusAfterTransition).

---

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)