<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSStoryboard/instantiateInitialController(creator:)-pi04",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "s:So12NSStoryboardC6AppKitE28instantiateInitialController7creatorxSgAFSo7NSCoderCcSg_tSo06NSViewF0CRbzlF"
  },
  "title" : "instantiateInitialController(creator:)"
}
-->

# instantiateInitialController(creator:)

Creates the initial view controller from the storyboard and initializes it using your custom code.

```
func instantiateInitialController<Controller>(creator: ((NSCoder) -> Controller?)? = nil) -> Controller? where Controller : NSViewController
```

## Parameters

`creator`

A block that contains your custom creation code for the view controller. Use this block to create the view controller, initialize it with the provided coder object and any custom information you require, and return the result. This block returns a new view controller object and takes the following parameter:

- coder: The coder object that contains the storyboard data to use when configuring the view controller.

    If you return     `nil`     from your block, this method creates the view controller using the default [`init(coder:)`](/documentation/AppKit/NSViewController/init(coder:))     method.

## Return Value

The initial view controller in the storyboard.

## Discussion

Every storyboard file has an initial controller object that represents the default interface to create. Use this method to construct that object using a custom code that you provide. Use this method when the constructor for your object takes parameters in addition to the specified `coder` object.

In your `creator` block, create the view controller using your custom constructor method. Your custom constructor method must accept an <doc://com.apple.documentation/documentation/Foundation/NSCoder> parameter and must call the inherited [`init(coder:)`](/documentation/AppKit/NSResponder/init(coder:)) method at some point during its execution. Not doing so is a programmer error.

---

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)