A collection of useful and frequently used SwiftUI components for iOS development, including:
- GRButton - Customizable buttons with loading states and icons
- GRInputField - Advanced input fields with validation
- GRToggle - Custom toggles, checkboxes, and radio buttons
- GRAsyncImage - Async image loading with caching
- ReadableContentWidth - Content width constraints for better readability
Designed to help developers build consistent, accessible, and production-ready UIs faster.
- Open your project in Xcode
- Go to File β Add Packages...
- Enter the repository URL:
https://github.com/GoodRequest/GoodSwiftUI - Select the version and add the package
import PackageDescription
let package = Package(
name: "YourProject",
dependencies: [
.package(url: "https://github.com/GoodRequest/GoodSwiftUI", from: "1.0.0")
],
targets: [
.target(
name: "YourTarget",
dependencies: [
.product(name: "GoodSwiftUI", package: "GoodSwiftUI"),
]
)
]
)import SwiftUI
import GRButton
import GRInputField
@main
struct MyApp: App {
init() {
InputFieldView.configureAppearance()
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
struct ContentView: View {
@State private var email = ""
var body: some View {
VStack(spacing: 20) {
InputField(text: $email, title: "Email", placeholder: "email@example.com")
Button("Submit") { }
.buttonStyle(GRButtonStyle(appearance: .primary, size: .large(stretch: false)))
}
.padding()
}
}Usage Guide - Complete documentation with examples for all components:
- Installation and setup
- Component examples (GRButton, GRInputField, GRToggle, GRAsyncImage)
- Helper patterns to reduce cognitive load
- Best practices and accessibility
- SwiftUI property mapping
AI Usage Rules - Structured rules for AI coding assistants:
- Development speed optimizations
- When to use library vs native SwiftUI
- Copy-paste templates and patterns
- Progressive complexity levels
- Cognitive load reduction strategies
- GRButton - Buttons with loading states, icons, and custom appearances
- GRInputField - Input fields with validation, formatting, and accessibility
- GRToggle - Switches, checkboxes, and radio buttons
- GRAsyncImage - Async image loading with caching
- ReadableContentWidth - Content width constraints for iPad
Explore the GoodSwiftUI-Sample directory for complete examples and snapshot tests.
GoodSwiftUI is released under the MIT license. See LICENSE for details.