---
title: "init(idType:y:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/scrollposition/init(idtype:y:)"
---

# init(idType:y:)

Creates a new scroll position to be scrolled to the provided y value.

## Declaration

```swift
init(idType: (some Hashable & Sendable).Type = Never.self, y: CGFloat)
```

## Discussion

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.
