---
title: "init(_:for:backgroundStyle:_:onDocumentOpen:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/documentlaunchview/init(_:for:backgroundstyle:_:ondocumentopen:)"
---

# init(_:for:backgroundStyle:_:onDocumentOpen:)

Creates a view to present when launching document-related user experiences using a localized title, custom actions, and a background style.

## Declaration

```swift
nonisolated init<B>(_ title: LocalizedStringKey, for contentTypes: [UTType], backgroundStyle: B, @ContentBuilder _ actions: () -> Actions, @ContentBuilder onDocumentOpen: @escaping (URL) -> DocumentView) where B : ShapeStyle
```

## Parameters

- `title`: A title key to use for the view title.
- `contentTypes`: Content types that the view can open.
- `backgroundStyle`: An optional background style of the view.
- `actions`: A content builder returning the view’s actions
- `onDocumentOpen`: A closure that handles an open file.

## Discussion

Discussion note: An alternative to DocumentLaunchView is a scene variant of this API: DocumentGroupLaunchScene. If the app definition contains DocumentGroup scenes, consider using a DocumentGroupLaunchScene instead of this view.
