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

# init(_:image:isOn:)

Creates a toggle that generates its label from a localized string resource
and image resource.

```
@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, image: ImageResource, isOn: Binding<Bool>)
```

## Parameters

`titleResource`

Text resource for the toggle’s localized title, that
describes the purpose of the toggle.

`image`

The name of the image resource to lookup.

`isOn`

A binding to a property that indicates whether the toggle is
on or off.

## Discussion

This initializer creates a [`Text`](/documentation/SwiftUI/Text) view on your behalf. See
`Text` for more information about localizing strings.

---

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)