---
title: "widgetURL(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/widgeturl(_:)"
---

# widgetURL(_:)

Sets the URL to open in the containing app when the user clicks the widget.

## Declaration

```swift
@MainActor @preconcurrency func widgetURL(_ url: URL?) -> some View

```

## Parameters

- `url`: The URL to open in the containing app.

## Return Value

Return Value A view that opens the specified URL when the user clicks the widget.

## Discussion

Discussion Widgets support one widgetURL modifier in their view hierarchy. If multiple views have widgetURL modifiers, the behavior is undefined.

## See Also

### URLs

- [onOpenURL(perform:)](swiftui/view/onopenurl(perform:).md)
- [onOpenURL(prefersInApp:)](swiftui/view/onopenurl(prefersinapp:).md)
