---
title: "init(levels:switchingAt:)"
framework: realitykit
role: symbol
role_heading: Initializer
path: "realitykit/levelofdetailcomponent/init(levels:switchingat:)"
---

# init(levels:switchingAt:)

Creates a new Level of Detail component.

## Declaration

```swift
init(levels: [LevelOfDetailComponent.DetailLevel], switchingAt strategy: LevelOfDetailComponent.SelectionStrategy)
```

## Parameters

- `levels`: Array of detail levels, where each level contains entities to show at that level.
- `strategy`: The selection strategy with threshold values.

## See Also

### Creating a component

- [addByCameraDistance(to:levels:)](realitykit/levelofdetailcomponent/addbycameradistance(to:levels:).md)
- [addByScreenArea(to:levels:)](realitykit/levelofdetailcomponent/addbyscreenarea(to:levels:).md)
- [addByResolutionMetric(to:levels:boundingBox:)](realitykit/levelofdetailcomponent/addbyresolutionmetric(to:levels:boundingbox:).md)
