---
title: "subscript(_:as:)"
framework: swiftdata
role: symbol
role_heading: Instance Subscript
path: "swiftdata/modelactor/subscript(_:as:)"
---

# subscript(_:as:)

Returns the model for the specified identifier, downcast to the appropriate class.

## Declaration

```swift
subscript<T>(id: PersistentIdentifier, as as: T.Type) -> T? where T : PersistentModel { get }
```
