---
title: "setDefaultApplication(at:toOpenContentTypeOfFileAt:completion:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsworkspace/setdefaultapplication(at:toopencontenttypeoffileat:completion:)"
---

# setDefaultApplication(at:toOpenContentTypeOfFileAt:completion:)

Sets the default app to use when opening files of a specific content type defined by a file URL.

## Declaration

```swift
func setDefaultApplication(at applicationURL: URL, toOpenContentTypeOfFileAt url: URL, completion completionHandler: (@Sendable ((any Error)?) -> Void)? = nil)
```

```swift
func setDefaultApplication(at applicationURL: URL, toOpenContentTypeOfFileAt url: URL) async throws
```

## Parameters

- `applicationURL`: The URL of the default application.
- `url`: The URL of the file specifying the content type to open.
- `completionHandler`: The completion handler to call after the operation completes.

## Discussion

Discussion This method sets the default app to open files of the type specified by the file url. If a change requires user consent, the system asks the user for consent asynchronously before invoking the completion handler.

## See Also

### Setting Default Application Information

- [setDefaultApplication(at:toOpenFileAt:completion:)](appkit/nsworkspace/setdefaultapplication(at:toopenfileat:completion:).md)
- [setDefaultApplication(at:toOpen:completion:)](appkit/nsworkspace/setdefaultapplication(at:toopen:completion:).md)
- [setDefaultApplication(at:toOpenURLsWithScheme:completion:)](appkit/nsworkspace/setdefaultapplication(at:toopenurlswithscheme:completion:).md)
