Open-source workspace for Swift & SwiftUI experiments, patterns and reusable tools.
SwiftBook is a living knowledge base for everything we learn while shipping Swift and SwiftUI apps.
Instead of scattering snippets across gists and closed repos, we collect them here—fully documented, indexed and ready for humans and AI to reuse.
Powered by PatternBook, every commit becomes searchable, clonable documentation.
- Browse real-world SwiftUI patterns (MVVM, TCA, etc.)
- Copy-paste battle-tested components into your own apps
- Let LLMs generate code that follows our house style
- Contribute new patterns or fixes upstream
- Closed-source or client-specific code
- One-off experiments that don't generalize
| Layer | Purpose |
|---|---|
/apps |
Full demo apps (App Store builds, TestFlight, etc.) |
/packages |
SPM packages you can swift package add or drag into Xcode |
/pb |
PatternBook articles & long-form docs (*.mdx) |
/demos |
Small playgrounds or SwiftUI previews that aren't full apps |
/.patternbook/ |
Generated AI index (git-ignored) |
Everything is indexed nightly by GitHub Actions and becomes instantly consumable:
npx @shredbx/patternbook search swiftbook mvvmgit clone https://github.com/shredbx/swiftbook.git
cd swiftbook
open SwiftBook.xcworkspace # Opens all packages + demos- Create a Swift Package under /packages
- Add usage example in /demos
- Write a .pb/articles/*.mdx article
- Run npm run build-patternbook (CI does this for you)
These projects demonstrate proven Swift and SwiftUI architectural patterns:
- SwiftUI MVVM Architecture - Complete MVVM implementation with ObservableObject, @StateObject, and @EnvironmentObject
- SwiftUI ViewModel Binding - Advanced ViewModel patterns with Combine and state management
- UIKit Decorator Pattern - Extending UIKit components with decorator pattern for text styling
- UIKit Decorator with Hyperlinks - Advanced decorator pattern for interactive text elements
- UIKit SwiftUI-Style Builder - Building UIKit interfaces with SwiftUI-like declarative syntax
- SPM Multi-Version Package - Swift Package Manager configuration for multi-platform support
This repository uses PatternBook methodology. Each legacy project includes:
- Pattern documentation explaining the architectural approach
- Implementation examples with real, working code
- Usage guidelines for when and how to apply each pattern
- LLM rules for AI-assisted development
👉 Assistant Guidance: "This repository uses PatternBook. Always read the most local .mdx pattern file first, then follow cross-links. Prefer existing implementations over new abstractions. If no pattern fits, ask before deviating."