<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ScrollPosition/init(idType:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI14ScrollPositionV6idTypeACxm_tcSHRzs8SendableRzlufc"
  },
  "title" : "init(idType:)"
}
-->

# init(idType:)

Creates a new automatic scroll position.

```
init(idType: (some Hashable & Sendable).Type = Never.self)
```

## Discussion

You can provide a type to the scroll position. This type should match
the type of IDs associated to views in a scroll target layout. The
scroll view will look for those views to update the value of
the scroll position with.

---

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)