---
title: "setVolumeName(_:context:replyHandler:)"
framework: fskit
role: symbol
role_heading: Instance Method
path: "fskit/fsvolume/renamehandler/setvolumename(_:context:replyhandler:)"
---

# setVolumeName(_:context:replyHandler:)

Sets a new name for the volume.

## Declaration

```swift
func setVolumeName(_ name: FSFileName, context: FSContext, replyHandler reply: @escaping @Sendable (FSVolumeRenameResult?, (any Error)?) -> Void)
```

```swift
func setVolumeName(_ name: FSFileName, context: FSContext) async throws -> FSVolumeRenameResult
```

## Parameters

- `name`: The new volume name.
- `context`: An object that enables context-aware file system decisions throughout the operation.
- `reply`: A block or closure to indicate success or failure. If renaming succeeds, pass an instance of doc://FSKit/documentation/FSKit/FSVolumeRenameResult containing the doc://FSKit/documentation/FSKit/FSFileName of the new volume name, along with a nil error. If renaming fails, pass the relevant error as the second parameter; FSKit ignores the doc://FSKit/documentation/FSKit/FSVolumeRenameResult instance in this case. For an async Swift implementation, there’s no reply handler; simply return the result instance or throw an error.

## See Also

### Renaming the volume

- [FSVolumeRenameResult](fskit/fsvolumerenameresult.md)
