---
title: "setTileSamplerState(_:index:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlrendercommandencoder/settilesamplerstate(_:index:)"
---

# setTileSamplerState(_:index:)

Assigns a sampler state to an entry in the tile shader argument table.

## Declaration

```swift
func setTileSamplerState(_ sampler: (any MTLSamplerState)?, index: Int)
```

## Parameters

- `sampler`: An doc://com.apple.metal/documentation/Metal/MTLSamplerState instance the command assigns to an entry in the tile shader argument table for sampler states.
- `index`: An integer that represents the entry in the tile shader argument table for sampler states that stores a record of sampler.

## Discussion

Discussion By default, the sampler state at each index is nil.

## See Also

### Assigning sampler states

- [setTileSamplerState(_:lodMinClamp:lodMaxClamp:index:)](metal/mtlrendercommandencoder/settilesamplerstate(_:lodminclamp:lodmaxclamp:index:).md)
- [setTileSamplerStates(_:range:)](metal/mtlrendercommandencoder/settilesamplerstates(_:range:).md)
- [setTileSamplerStates(_:lodMinClamps:lodMaxClamps:range:)](metal/mtlrendercommandencoder/settilesamplerstates(_:lodminclamps:lodmaxclamps:range:).md)
