Welcome, agent! When making modifications to this repository on behalf of a human user, please strictly adhere to the following directives:
After performing a refactor or writing new code, always use your Xcode or build tools to dry-run a build and ensure no compiler errors were introduced. Do not ask for permission to verify your own code; proactively fix your errors.
Match the existing architectural patterns (SwiftData models, SwiftUI conventions) natively found in the DocBCore package. If you are modifying models, respect DTO bridging patterns.
If doing complex file replacements, prefer your native AST/diff editing tools over brittle bash tools like sed. Read files thoroughly to gain context before modifying.
This section details the conventions and best practices for writing code documentation within the DocB project. Following these instructions ensures that Xcode's Quick Help and DocC generation provide accurate, cleanly formatted documentation for all contributors.
- Write documentation as complete sentences with proper capitalization and punctuation.
- Summarize the purpose of the symbol in the very first sentence.
- Parameters: Use the standard Xcode
/// - Parameters:block, followed by indented/// - paramName: Descriptionlines. - Return Values: Use
/// - Returns: Descriptionto clarify return types if they are non-obvious. - Callouts: Use standard markup callouts like
/// - Important:,/// - Note:, or/// - Warning:where additional context is needed.
The exact placement of your /// comments depends on the specific modifiers and decorators preceding your types.
When a class or struct uses global attributes like @Model or @MainActor, the documentation comment should be placed before all attributes:
/// Encapsulates the application's configuration state.
@Model
public final class AppConfiguration {
// ...
}For typical property wrappers such as @State, @Binding, @Query, and @AppStorage, the documentation comment goes before the property wrapper:
/// The collections saved in SwiftData.
@Query(sort: \.lastUpdatedDate) private var collections: [BookmarkCollection] = []
/// Controls presentation of the creation sheet.
@State private var isShowingSheet = falseDo not document @Environment property wrappers. Across the entire project, calls injected from @Environment should be left uncommented to reduce clutter, as their usage is typically standardized and obvious by SwiftUI (e.g. dismiss, modelContext).
// Correct
@Environment(\.dismiss) private var dismiss
// Incorrect ❌
/// The dismiss action provided by the environment.
@Environment(\.dismiss) private var dismiss- Any
struct,class, model, or protocol exposed across theDocBCorepackage boundaries must be markedpublic. - Ensure that the primary initializer (
public init(...)) mapping the object's creation is thoroughly documented as well, alongside explicit parameter documentation.