---
title: "viewID(type:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/scrollposition/viewid(type:)"
---

# viewID(type:)

The id of the view positioned in the scroll view if configured to be in that position or the user has scrolled past a view with an id of matching type.

## Declaration

```swift
func viewID<T>(type: T.Type) -> T? where T : Hashable, T : Sendable
```
