<!--
{
  "availability" : [
    "iOS: 11.0.0 - 15.0.0",
    "iPadOS: 11.0.0 - 15.0.0",
    "macCatalyst: 13.1.0 - 15.0.0",
    "visionOS: 1.0.0 - 1.0.0",
    "watchOS: 4.0.0 - 8.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "SiriKit",
  "identifier" : "/documentation/Intents/INGetVisualCodeIntent/init(visualCodeType:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Intents"
    ],
    "preciseIdentifier" : "c:objc(cs)INGetVisualCodeIntent(im)initWithVisualCodeType:"
  },
  "title" : "init(visualCodeType:)"
}
-->

# init(visualCodeType:)

Initializes the intent object with information about the requested type of code.

```
init(visualCodeType: INVisualCodeType)
```

## Parameters

`visualCodeType`

The type of visual code that the user requested. For a list of possible values, see [`INVisualCodeType`](/documentation/Intents/INVisualCodeType).

## Return Value

An initialized intent object or `nil` if the object could not be created.

## Discussion

Normally, you don’t create instances of this class yourself. Instead, SiriKit creates instances when the user asks for a visual code from your app. However, you can use this method during testing to create intent objects in order to validate your intent handling code paths.

---

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)