docs: Update README with complete feature documentation

This commit is contained in:
Matt Bruce 2026-01-02 11:59:57 -06:00
parent 7afa45698f
commit 8e788ef212

142
README.md
View File

@ -9,11 +9,11 @@ Bedrock is designed to be the foundation upon which apps are built, providing:
- **Design System**: Consistent spacing, typography, colors, and animations - **Design System**: Consistent spacing, typography, colors, and animations
- **Color Protocols**: Define consistent color naming with custom palettes per app - **Color Protocols**: Define consistent color naming with custom palettes per app
- **Settings Components**: Ready-to-use toggle, picker, and selector views - **Settings Components**: Ready-to-use toggle, picker, and selector views
- **Sound & Haptics**: Generic sound and haptic feedback management - **Sound & Haptics**: Generic sound manager with haptic feedback support
- **Onboarding**: Track user onboarding progress and contextual hints - **Onboarding**: First-time user experience and contextual hints
- **Cloud Sync**: Generic iCloud and local data synchronization - **Cloud Sync**: Generic iCloud data synchronization
- **Visual Effects**: Confetti, pulsing animations, debug borders - **Visual Effects**: Confetti celebrations, pulsing animations
- **Utilities**: Device detection, debugging helpers, and more - **Utilities**: Device detection, debugging tools, and more
## Installation ## Installation
@ -21,15 +21,7 @@ Add Bedrock as a dependency in your `Package.swift`:
```swift ```swift
dependencies: [ dependencies: [
.package(url: "https://github.com/yourname/Bedrock.git", from: "1.0.0") .package(url: "ssh://git@192.168.1.128:220/mbrucedogs/Bedrock.git", branch: "master")
]
```
Or for local development:
```swift
dependencies: [
.package(path: "../Bedrock")
] ]
``` ```
@ -99,9 +91,9 @@ public enum MyAppAccentColors: AccentColorProvider {
// Create a complete theme // Create a complete theme
public enum MyAppTheme: AppColorTheme { public enum MyAppTheme: AppColorTheme {
public typealias Surface = DefaultSurfaceColors // Reuse Bedrock defaults public typealias Surface = DefaultSurfaceColors // Reuse Bedrock defaults
public typealias Text = DefaultTextColors public typealias Text = DefaultTextColors
public typealias Accent = MyAppAccentColors // Custom accents public typealias Accent = MyAppAccentColors // Custom accents
public typealias Button = DefaultButtonColors public typealias Button = DefaultButtonColors
public typealias Status = DefaultStatusColors public typealias Status = DefaultStatusColors
public typealias Border = DefaultBorderColors public typealias Border = DefaultBorderColors
@ -113,14 +105,26 @@ Button("Action") { }
.background(MyAppTheme.Accent.primary) .background(MyAppTheme.Accent.primary)
``` ```
### Sound & Haptic Feedback #### Available Color Protocols
Bedrock provides a generic sound manager that works with any app-defined sounds: | Protocol | Properties |
|----------|------------|
| `SurfaceColorProvider` | primary, secondary, tertiary, overlay, card, groupedFill, sectionFill |
| `TextColorProvider` | primary, secondary, tertiary, disabled, placeholder, inverse |
| `AccentColorProvider` | primary, light, dark, secondary |
| `ButtonColorProvider` | primaryLight, primaryDark, secondary, destructive, cancelText |
| `StatusColorProvider` | success, warning, error, info |
| `BorderColorProvider` | subtle, standard, emphasized, selected |
| `InteractiveColorProvider` | selected, hover, pressed, focus |
### Sound & Haptics
Generic sound manager that works with any app-defined sounds:
```swift ```swift
// Define your app's sounds // Define your app's sounds
enum MySound: String, AppSound { enum MyAppSound: String, AppSound {
case tap, success, error case success, error, notification
var resourceName: String { rawValue } var resourceName: String { rawValue }
var resourceExtension: String { "mp3" } var resourceExtension: String { "mp3" }
@ -130,50 +134,59 @@ enum MySound: String, AppSound {
// Play sounds and haptics // Play sounds and haptics
let soundManager = SoundManager.shared let soundManager = SoundManager.shared
soundManager.play(MySound.success) soundManager.play(MyAppSound.success)
soundManager.playHaptic(.success) soundManager.playHaptic(.success)
soundManager.playHaptic(.light)
``` ```
### Onboarding State ### Onboarding State
Track user onboarding and progressive feature discovery: Track first-time user experience and contextual hints:
```swift ```swift
let onboarding = OnboardingState(appIdentifier: "myApp") @Observable
class AppState {
let onboarding = OnboardingState(appIdentifier: "myApp")
// Register all hint keys for skip functionality var showWelcome: Bool {
onboarding.registerHintKeys("welcome", "feature1", "feature2") !onboarding.hasCompletedWelcome
}
// Check and show hints
if onboarding.shouldShowHint("welcome") {
// Show welcome hint
onboarding.markHintShown("welcome")
} }
// Skip or complete onboarding // Register hints for skip functionality
onboarding.completeWelcome() // Mark as completed onboarding.registerHintKeys("firstBet", "settings", "tutorial")
onboarding.skipOnboarding() // Skip all hints
// Check if hints should show
if onboarding.shouldShowHint("firstBet") {
// Show hint
onboarding.markHintShown("firstBet")
}
// Complete onboarding
onboarding.completeWelcome()
``` ```
### Cloud Sync ### Cloud Sync
Synchronize data between iCloud and local storage: Generic iCloud synchronization for app data:
```swift ```swift
// Define your persistable data // Define your persisted data
struct MyAppData: PersistableData { struct MyAppData: PersistableData {
static var dataIdentifier = "myApp" static var dataIdentifier = "myApp"
static var empty = MyAppData() static var empty = MyAppData()
var syncPriority: Int { totalActions } var syncPriority: Int { score }
var lastModified: Date = .now var lastModified: Date = .now
var totalActions: Int = 0 var score: Int = 0
} }
// Use the cloud sync manager // Create sync manager
let syncManager = CloudSyncManager<MyAppData>() let syncManager = CloudSyncManager<MyAppData>()
await syncManager.save(myData)
let loaded = await syncManager.load() // Access and modify data
syncManager.data.score += 10
syncManager.save()
``` ```
### Visual Effects ### Visual Effects
@ -185,25 +198,18 @@ ZStack {
MainContentView() MainContentView()
if showCelebration { if showCelebration {
ConfettiView(colors: [.red, .blue, .green, .yellow]) ConfettiView(colors: [.red, .blue, .gold], count: 50)
} }
} }
``` ```
#### Pulsing Animation #### Pulsing Attention
```swift ```swift
Button("Tap Here") { } Button("Tap Here") { }
.pulsing(isActive: shouldHighlight, color: .white) .pulsing(isActive: shouldHighlight, color: .white)
``` ```
#### Debug Borders
```swift
MyComplexView()
.debugBorder(showDebug, color: .red, label: "Header")
```
### Settings Components ### Settings Components
Ready-to-use settings UI components: Ready-to-use settings UI components:
@ -222,11 +228,14 @@ VolumePicker(label: "Volume", volume: $soundVolume)
// Segmented picker // Segmented picker
SegmentedPicker( SegmentedPicker(
title: "Theme", title: "Theme",
options: [("Light", "light"), ("Dark", "dark"), ("Auto", "auto")], options: [
SegmentedOption(label: "Light", value: "light"),
SegmentedOption(label: "Dark", value: "dark")
],
selection: $theme selection: $theme
) )
// Selectable row // Selectable row with badge
SelectableRow( SelectableRow(
title: "Premium Plan", title: "Premium Plan",
subtitle: "Unlock all features", subtitle: "Unlock all features",
@ -236,6 +245,13 @@ SelectableRow(
) )
``` ```
### Debug Tools
```swift
MyComplexView()
.debugBorder(isDebugMode, color: .red, label: "Header")
```
### Device Detection ### Device Detection
Adapt your UI based on device characteristics: Adapt your UI based on device characteristics:
@ -247,8 +263,9 @@ if DeviceInfo.isPad {
TabBarView() TabBarView()
} }
let bounds = DeviceInfo.screenBounds if DeviceInfo.isLandscape {
let isLandscape = DeviceInfo.isLandscape HorizontalLayout()
}
``` ```
## Design System Reference ## Design System Reference
@ -280,17 +297,14 @@ let isLandscape = DeviceInfo.isLandscape
| `heavy` | 0.8 | Heavy overlays | | `heavy` | 0.8 | Heavy overlays |
| `almostFull` | 0.9 | Nearly opaque | | `almostFull` | 0.9 | Nearly opaque |
### Color Protocols ### Animation
| Protocol | Properties | | Name | Value | Usage |
|----------|------------| |------|-------|-------|
| `SurfaceColorProvider` | primary, secondary, tertiary, overlay, card, groupedFill, sectionFill | | `quick` | 0.3s | Quick transitions |
| `TextColorProvider` | primary, secondary, tertiary, disabled, placeholder, inverse | | `standard` | 0.5s | Standard animations |
| `AccentColorProvider` | primary, light, dark, secondary | | `springDuration` | 0.4s | Spring animations |
| `ButtonColorProvider` | primaryLight, primaryDark, secondary, destructive, cancelText | | `staggerDelay` | 0.1s | Staggered animations |
| `StatusColorProvider` | success, warning, error, info |
| `BorderColorProvider` | subtle, standard, emphasized, selected |
| `InteractiveColorProvider` | selected, hover, pressed, focus |
## Requirements ## Requirements
@ -300,4 +314,4 @@ let isLandscape = DeviceInfo.isLandscape
## License ## License
MIT License Proprietary - All rights reserved.