---
title: "setHasContent(_:forWidgetWithBundleIdentifier:)"
framework: notificationcenter
role: symbol
role_heading: Instance Method
path: "notificationcenter/ncwidgetcontroller/sethascontent(_:forwidgetwithbundleidentifier:)"
---

# setHasContent(_:forWidgetWithBundleIdentifier:)

Sets whether the specified widget has content to display.

## Declaration

```swift
func setHasContent(_ flag: Bool, forWidgetWithBundleIdentifier bundleID: String)
```

## Parameters

- `flag`: Indicates whether the widget has content to display. Default value is doc://com.apple.documentation/documentation/Swift/true.
- `bundleID`: The bundle identifier of the widget.

## Discussion

Discussion Both a widget and its containing app can use this method to specify whether the widget has content to display. The value of flag determines whether a widget should be visible in the Today view and whether the widget’s most recent snapshot is still valid.
