Skip to main content
This cookbook provides guidelines for AI coding assistants (e.g. Gemini, Claude, Copilot) when generating Swift code that integrates BoutiqueDB.

Core Rules for AI Code Generation

Always Use Sendable Structs: Model declarations MUST be value-type structs conforming to Sendable. Never generate final class models for @Table types.
Use StructuredQueries Macros: Model properties must use @Column modifiers and explicit primary keys.
SwiftUI @ObservationIgnored Annotation: When initializing @LiveQuery inside a SwiftUI View or @Observable class, annotate the property with @ObservationIgnored to avoid redundant observation wrappers.

Canonical Code Template

CanonicalModel.swift