Contents

antonio081014/ARadioButtonGroup

A lightweight, customizable **radio button group UI** for SwiftUI that works seamlessly on **macOS**, **iOS**, and **tvOS**.

✨ Features

  • 🎯 Cross-platform β€” Supports macOS, iOS, and tvOS.
  • 🎨 Customizable β€” Easily change colors, fonts and selection style.
  • πŸ›  SwiftUI-native β€” Built entirely in SwiftUI, no UIKit/AppKit bridging required.
  • ⚑ Lightweight β€” No external dependencies.
  • πŸ“¦ Swift Package Manager support.
  • πŸ“ Multiline label support β€” Text labels can span multiple lines, while the circle selection view dynamically matches the height of the first line for perfect alignment.

πŸ“¦ Installation

Swift Package Manager (SPM)

You can add ARadioButtonGroup to your project using Swift Package Manager:

  1. In Xcode, go to File > Add Packages...
  2. Paste the package URL: https://github.com/antonio081014/ARadioButtonGroup
  3. Select the version and add it to your target.

Or add it manually to Package.swift:

dependencies: [
 .package(url: "https://github.com/antonio081014/ARadioButtonGroup.git", from: "1.3.0")
]

πŸš€ Usage

Basic Example

import SwiftUI
import ARadioButtonGroup

struct ContentView: View {
    @State private var selectedOption: String? = "Option 1"

    let options = ["Option 1", "Option 2", "Option 3"]

    var body: some View {
        ARadioButtonGroup(
            optionCandidates: options,
            selectedOption: $selectedOption
        )
        .padding()
        .font(.largeTitle) // Modify Text Font
        .tint(Color.blue)   // Modify Circle Color
    }
}

Example: Radio Button Group in HStack

[Radio Button Group in HStack]

Example: Radio Button Group in VStack with multiline text supporting

[Radio Button Group in VStack]

πŸ›‘ License

This project is licensed under the MIT License.

🀝 Contributing

Pull requests are welcome! If you find bugs or have feature requests, please open an issue.

Package Metadata

Repository: antonio081014/ARadioButtonGroup

Stars: 0

Forks: 0

Open issues: 0

Default branch: main

Primary language: swift

License: MIT

README: README.md