This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- Build:
swift build - Test all:
swift test - Test specific target:
swift test --filter DevColorExtractionTests
- Lint:
Scripts/lint(usesswift format lint --recursive --strict) - Format:
Scripts/format(usesswift format --in-place)
The repository uses GitHub Actions for CI/CD with the workflow in
.github/workflows/VerifyChanges.yaml. The workflow:
- Lints code on PRs using
swift format - Builds and tests on iOS, macOS, and tvOS
- Generates code coverage reports using xccovPretty
- Uses Xcode 26.3 and macOS 26 runners
DevColorExtraction is a Swift package that extracts the most common colors from images using k-means clustering. It provides efficient color analysis with support for edge-based extraction.
Sources/DevColorExtraction/
├── MostCommonColors.swift # Core color extraction via CGImage extensions
├── EdgeSet.swift # Edge set type for edge-based extraction
└── Documentation.docc/ # DocC documentation
CGImage.mostCommonColors(count:passes:)— extract most common colors from an imageCGImage.mostCommonColors(count:passes:edges:)— extract colors from specific edgesEdgeSet— option set for specifying image edges (top, left, bottom, right)
External dependencies managed via Swift Package Manager:
- swift-numerics: Numeric utilities (RealModule, used in tests)
The codebase maintains >97% test coverage. Tests are in Tests/DevColorExtractionTests/ with
test image resources in Tests/DevColorExtractionTests/Resources/.
- iOS 18+
- macOS 15+
- tvOS 18+
The project follows strict spacing conventions for readability and consistency:
- 2 blank lines between major sections including:
- Between the last property declaration and first function declaration
- Between all function/computed property implementations at the same scope level
- Between top-level type declarations (class, struct, enum, protocol, extension)
- Before MARK comments that separate major sections
- 1 blank line for minor separations:
- Between property declarations and nested type definitions
- Between all function definitions in protocols
- After headers in documentation
- After MARK comments that separate major sections
- File endings: All Swift files must end with exactly one blank line
When writing Markdown documentation, reference @Documentation/MarkdownStyleGuide.md to
ensure consistent formatting, structure, and style across all project documentation. Key
standards:
- Line Length: 100 characters maximum
- Code Blocks: Use 4-space indentation instead of fenced blocks
- Lists: Use
-for bullets with proper indentation alignment - Spacing: 2 blank lines between major sections, 1 blank line after headers
- Terminology: Use "function" over "method", "type" over "class"
- Follows Swift API Design Guidelines
- Uses Swift 6.2 with
ExistentialAnyandMemberImportVisibilityfeatures enabled - All public APIs are documented and tested
- Test coverage target: >97%