<!--
{
  "availability" : [
    "macOS: 10.10.0 - 11.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "NotificationCenter",
  "identifier" : "/documentation/NotificationCenter/NCWidgetListViewController/viewController(atRow:makeIfNecessary:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Notification Center"
    ],
    "preciseIdentifier" : "c:objc(cs)NCWidgetListViewController(im)viewControllerAtRow:makeIfNecessary:"
  },
  "title" : "viewController(atRow:makeIfNecessary:)"
}
-->

# viewController(atRow:makeIfNecessary:)

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

```
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

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.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)