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:
- In Xcode, go to File > Add Packages...
- Paste the package URL: https://github.com/antonio081014/ARadioButtonGroup
- 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