---
title: "init(id:anchor:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/scrollposition/init(id:anchor:)"
---

# init(id:anchor:)

Creates a new scroll position to a view with a provided identity value.

## Declaration

```swift
init(id: some Hashable & Sendable, anchor: UnitPoint? = nil)
```

## Discussion

Discussion The type of the ID indicates the type of ID of views within a scroll target layout the scroll view should look for.
