<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Toggle/init(_:isOn:intent:)-1rk6x",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI6ToggleV012_AppIntents_aB0AA4TextVRszrlE_4isOn6intentACyAFGqd___Sbqd_0_tcSyRd__0dE00D6IntentRd_0_r0_lufc"
  },
  "title" : "init(_:isOn:intent:)"
}
-->

# init(_:isOn:intent:)

Creates a toggle that generates its label from a string.

```
nonisolated init<S>(_ title: S, isOn: Bool, intent: some AppIntent) where S : StringProtocol
```

## Parameters

`title`

A string that describes the purpose of the toggle.

`isOn`

Whether the toggle is on or off.

`intent`

The `AppIntent` to be performed.

## Discussion

This initializer creates a `Text` view on your behalf, and treats the
title similar to `Text/init(_:)-9d1g4`. See `Text` for more
information about localizing strings.

To initialize a toggle with a localized string key, use
`Toggle/init(_:isOn:intent:)` instead.

---

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)