---
title: "viewController(atRow:makeIfNecessary:)"
framework: Notification Center
role: symbol
role_heading: Instance Method
platforms: [macOS 10.10+]
path: "notificationcenter/ncwidgetlistviewcontroller/viewcontroller(atrow:makeifnecessary:)"
---

# viewController(atRow:makeIfNecessary:)

Returns the content view controller associated with the specified row, or a new content view controller if desired.

## Declaration

```swift
func viewController(atRow row: Int, makeIfNecessary makeIfNecesary: Bool) -> NSViewController
```

## Parameters

- `row`: The row in the list.
- `makeIfNecesary`: Specify doc://com.apple.documentation/documentation/Swift/true to create a new content view controller if none exists or doc://com.apple.documentation/documentation/Swift/false to reuse an existing row.

## Return Value

Return Value The content view controller associated with the specified row, if one exists. Returns nil if the row doesn’t have a content view controller and you don’t want to create one.

## See Also

### Accessing Content

- [contents](notificationcenter/ncwidgetlistviewcontroller/contents.md)
- [row(for:)](notificationcenter/ncwidgetlistviewcontroller/row(for:).md)
