---
title: "discardRecording(handler:)"
framework: replaykit
role: symbol
role_heading: Instance Method
path: "replaykit/rpscreenrecorder/discardrecording(handler:)"
---

# discardRecording(handler:)

Discards the current recording.

## Declaration

```swift
func discardRecording(handler: @escaping () -> Void)
```

## Parameters

- `handler`: A block that is called when the request is completed.

## Discussion

Discussion discardRecording(handler:) can only be called after the handler block in stopRecording(handler:) has been called. Use the handler block to do any required cleanup, including setting any RPPreviewScreenController references to nil.

## See Also

### Controlling App Recording

- [startRecording(handler:)](replaykit/rpscreenrecorder/startrecording(handler:).md)
- [stopRecording(handler:)](replaykit/rpscreenrecorder/stoprecording(handler:).md)
- [stopRecording(withOutput:completionHandler:)](replaykit/rpscreenrecorder/stoprecording(withoutput:completionhandler:).md)
- [startCapture(handler:completionHandler:)](replaykit/rpscreenrecorder/startcapture(handler:completionhandler:).md)
- [RPSampleBufferType](replaykit/rpsamplebuffertype.md)
- [stopCapture(handler:)](replaykit/rpscreenrecorder/stopcapture(handler:).md)
- [startRecording(withMicrophoneEnabled:handler:)](replaykit/rpscreenrecorder/startrecording(withmicrophoneenabled:handler:).md)
