---
title: "fileMover(isPresented:file:onCompletion:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/filemover(ispresented:file:oncompletion:)"
---

# fileMover(isPresented:file:onCompletion:)

Presents a system dialog for allowing the user to move an existing file to a new location.

## Declaration

```swift
nonisolated func fileMover(isPresented: Binding<Bool>, file: URL?, onCompletion: @escaping (Result<URL, any Error>) -> Void) -> some View

```

## Parameters

- `isPresented`: A binding to whether the dialog should be shown.
- `file`: The URL of the file to be moved.
- `onCompletion`: A callback that will be invoked when the operation has has succeeded or failed. To access the received URLs, call startAccessingSecurityScopedResource. When the access is no longer required, call stopAccessingSecurityScopedResource.

## Discussion

Discussion note: This dialog provides security-scoped URLs. Call the startAccessingSecurityScopedResource method to access or bookmark the URLs, and the stopAccessingSecurityScopedResource method to release the access. In order for the dialog to appear, both isPresented must be true and file must not be nil. When the operation is finished, isPresented will be set to false before onCompletion is called. If the user cancels the operation, isPresented will be set to false and onCompletion will not be called. To further configure the dialog’s appearance and behavior, use these view modifiers: fileDialogDefaultDirectory(_:), fileDialogConfirmationLabel(_:), fileDialogMessage(_:), fileDialogBrowserOptions(_:), fileDialogURLEnabled(_:), fileDialogImportsUnresolvedAliases(_:), and fileDialogCustomizationID(_:).

## See Also

### Moving a file

- [fileMover(isPresented:files:onCompletion:)](swiftui/view/filemover(ispresented:files:oncompletion:).md)
- [fileMover(isPresented:file:onCompletion:onCancellation:)](swiftui/view/filemover(ispresented:file:oncompletion:oncancellation:).md)
- [fileMover(isPresented:files:onCompletion:onCancellation:)](swiftui/view/filemover(ispresented:files:oncompletion:oncancellation:).md)
