Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.swiftcn.lol/llms.txt

Use this file to discover all available pages before exploring further.

CustomToggle Component in SwiftUI

Overview

CustomToggle is a SwiftUI component designed for creating a customizable toggle switch with a label. This component takes advantage of SwiftUI’s ToggleStyle to allow for a visually appealing and interactive experience.

Preview

Toggle On

Toggle Off

Installation

Include the CustomToggle.swift file in your SwiftUI project. File Link

Properties

Required Properties

  • label: String - The label that appears next to the toggle.

State Variable

  • state: Bool - A state variable that tracks the on/off state of the toggle.

Usage

Basic Usage

Here’s how you can use the CustomToggle component:
CustomToggle(
    label: "Toggle me"
)