Compare commits

..

No commits in common. "8e788ef2121024b25ac6150d857140af6bcd64c2" and "fa7d848f522efa0126a569aebdbfbaef3e0b30c1" have entirely different histories.

168
README.md
View File

@ -6,14 +6,10 @@ A foundational design system and UI component library for building consistent, b
Bedrock is designed to be the foundation upon which apps are built, providing: 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, 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 manager with haptic feedback support - **Utilities**: Common helpers for device detection, debugging, and more
- **Onboarding**: First-time user experience and contextual hints
- **Cloud Sync**: Generic iCloud data synchronization
- **Visual Effects**: Confetti celebrations, pulsing animations
- **Utilities**: Device detection, debugging tools, and more
## Installation ## Installation
@ -21,7 +17,7 @@ Add Bedrock as a dependency in your `Package.swift`:
```swift ```swift
dependencies: [ dependencies: [
.package(url: "ssh://git@192.168.1.128:220/mbrucedogs/Bedrock.git", branch: "master") .package(path: "../Bedrock")
] ]
``` ```
@ -81,28 +77,28 @@ VStack { }
Apps can define custom color palettes by conforming to the color protocols: Apps can define custom color palettes by conforming to the color protocols:
```swift ```swift
// Define custom accent colors // In CasinoKit - define casino-themed accent colors
public enum MyAppAccentColors: AccentColorProvider { public enum CasinoAccentColors: AccentColorProvider {
public static let primary = Color(red: 0.9, green: 0.75, blue: 0.3) public static let primary = Color(red: 0.9, green: 0.75, blue: 0.3) // Gold
public static let light = Color(red: 1.0, green: 0.85, blue: 0.4) public static let light = Color(red: 1.0, green: 0.85, blue: 0.4)
public static let dark = Color(red: 0.7, green: 0.55, blue: 0.2) public static let dark = Color(red: 0.7, green: 0.55, blue: 0.2)
public static let secondary = Color(red: 0.2, green: 0.7, blue: 0.7) public static let secondary = Color(red: 0.2, green: 0.7, blue: 0.7) // Teal
} }
// Create a complete theme // Create a complete theme
public enum MyAppTheme: AppColorTheme { public enum CasinoTheme: AppColorTheme {
public typealias Surface = DefaultSurfaceColors // Reuse Bedrock defaults public typealias Surface = CasinoSurfaceColors
public typealias Text = DefaultTextColors public typealias Text = DefaultTextColors // Reuse Bedrock defaults
public typealias Accent = MyAppAccentColors // Custom accents public typealias Accent = CasinoAccentColors // Custom gold accents
public typealias Button = DefaultButtonColors public typealias Button = CasinoButtonColors
public typealias Status = DefaultStatusColors public typealias Status = DefaultStatusColors // Reuse Bedrock defaults
public typealias Border = DefaultBorderColors public typealias Border = DefaultBorderColors
public typealias Interactive = DefaultInteractiveColors public typealias Interactive = DefaultInteractiveColors
} }
// Use in views // Use in views
Button("Action") { } Button("Deal") { }
.background(MyAppTheme.Accent.primary) .background(CasinoTheme.Accent.primary)
``` ```
#### Available Color Protocols #### Available Color Protocols
@ -117,99 +113,6 @@ Button("Action") { }
| `BorderColorProvider` | subtle, standard, emphasized, selected | | `BorderColorProvider` | subtle, standard, emphasized, selected |
| `InteractiveColorProvider` | selected, hover, pressed, focus | | `InteractiveColorProvider` | selected, hover, pressed, focus |
### Sound & Haptics
Generic sound manager that works with any app-defined sounds:
```swift
// Define your app's sounds
enum MyAppSound: String, AppSound {
case success, error, notification
var resourceName: String { rawValue }
var resourceExtension: String { "mp3" }
var bundle: Bundle { .main }
var fallbackSystemSoundID: UInt32? { nil }
}
// Play sounds and haptics
let soundManager = SoundManager.shared
soundManager.play(MyAppSound.success)
soundManager.playHaptic(.success)
soundManager.playHaptic(.light)
```
### Onboarding State
Track first-time user experience and contextual hints:
```swift
@Observable
class AppState {
let onboarding = OnboardingState(appIdentifier: "myApp")
var showWelcome: Bool {
!onboarding.hasCompletedWelcome
}
}
// Register hints for skip functionality
onboarding.registerHintKeys("firstBet", "settings", "tutorial")
// Check if hints should show
if onboarding.shouldShowHint("firstBet") {
// Show hint
onboarding.markHintShown("firstBet")
}
// Complete onboarding
onboarding.completeWelcome()
```
### Cloud Sync
Generic iCloud synchronization for app data:
```swift
// Define your persisted data
struct MyAppData: PersistableData {
static var dataIdentifier = "myApp"
static var empty = MyAppData()
var syncPriority: Int { score }
var lastModified: Date = .now
var score: Int = 0
}
// Create sync manager
let syncManager = CloudSyncManager<MyAppData>()
// Access and modify data
syncManager.data.score += 10
syncManager.save()
```
### Visual Effects
#### Confetti
```swift
ZStack {
MainContentView()
if showCelebration {
ConfettiView(colors: [.red, .blue, .gold], count: 50)
}
}
```
#### Pulsing Attention
```swift
Button("Tap Here") { }
.pulsing(isActive: shouldHighlight, color: .white)
```
### Settings Components ### Settings Components
Ready-to-use settings UI components: Ready-to-use settings UI components:
@ -228,14 +131,11 @@ VolumePicker(label: "Volume", volume: $soundVolume)
// Segmented picker // Segmented picker
SegmentedPicker( SegmentedPicker(
title: "Theme", title: "Theme",
options: [ options: [("Light", "light"), ("Dark", "dark"), ("Auto", "auto")],
SegmentedOption(label: "Light", value: "light"),
SegmentedOption(label: "Dark", value: "dark")
],
selection: $theme selection: $theme
) )
// Selectable row with badge // Selectable row
SelectableRow( SelectableRow(
title: "Premium Plan", title: "Premium Plan",
subtitle: "Unlock all features", subtitle: "Unlock all features",
@ -245,13 +145,6 @@ 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:
@ -262,10 +155,6 @@ if DeviceInfo.isPad {
} else { } else {
TabBarView() TabBarView()
} }
if DeviceInfo.isLandscape {
HorizontalLayout()
}
``` ```
## Design System Reference ## Design System Reference
@ -297,21 +186,22 @@ if DeviceInfo.isLandscape {
| `heavy` | 0.8 | Heavy overlays | | `heavy` | 0.8 | Heavy overlays |
| `almostFull` | 0.9 | Nearly opaque | | `almostFull` | 0.9 | Nearly opaque |
### Animation ### Default Colors
| Name | Value | Usage | Default colors use a neutral blue accent. Apps should define custom themes for branding:
|------|-------|-------|
| `quick` | 0.3s | Quick transitions | | Category | Purpose |
| `standard` | 0.5s | Standard animations | |----------|---------|
| `springDuration` | 0.4s | Spring animations | | `Color.Surface.*` | Background colors |
| `staggerDelay` | 0.1s | Staggered animations | | `Color.Text.*` | Text colors |
| `Color.Accent.*` | Accent/highlight colors (default: blue) |
| `Color.Button.*` | Button colors |
| `Color.Status.*` | Success/warning/error colors |
| `Color.Border.*` | Border and divider colors |
| `Color.Interactive.*` | Interactive state colors |
## Requirements ## Requirements
- iOS 18.0+ - iOS 18.0+
- macOS 15.0+ - macOS 15.0+
- Swift 6.0+ - Swift 6.0+
## License
Proprietary - All rights reserved.