Guide for agentic coding assistants working in this repository.
# Build the project
swift build
# Run all tests
swift test
# Run a single test (replace TestName with actual test name)
swift test --filter LucideSwiftTests/TestName
# Generate/update all icons from upstream Lucide
swift run LucideGenerator
# Build release
swift build -c release
# Clean build artifacts
swift package clean- Language: Swift 5.9+
- Platforms: iOS 14+, macOS 11+, tvOS 14+, watchOS 7+, visionOS 1+
- Zero runtime dependencies - pure Swift implementation (generator tool uses SVGPath)
Every file must include a standard header:
//
// Filename.swift
// LucideSwift
//
// Brief description of purpose
//import SwiftUI // For UI components
import Foundation // For non-UI logic
import XCTest // For tests only- Types: PascalCase (e.g.,
LucideIcon,SVGPathParser) - Methods/Properties: camelCase (e.g.,
pathData,normalizedPoint) - Icon names: camelCase converted from kebab-case (e.g.,
arrow-right→arrowRight) to align with Swift API Design Guidelines. - Enums: PascalCase with lowerCamelCase cases
- Constants: Static constants in Config structs
- Use
publicfor all public API - Use
internal(default) for implementation details - Use
privatefor truly internal helpers - Prefer
structoverclassfor value semantics - Use
enumfor command types and error handling
- Define custom errors in
enumconforming toError - Use
throwsfor functions that can fail - Handle errors with
do-catchblocks - Print errors with descriptive messages:
print("❌ Error: \(error)")
- Use triple-slash (
///) for public API documentation - Document parameters and return values
- Include usage examples in doc comments for complex types
- Files in
Sources/LucideSwift/Lucide+Generated.swiftare AUTO-GENERATED - Do not edit generated files manually
- Run
swift run LucideGeneratorto regenerate
- Tests in
Tests/LucideSwiftTests/ - Use
@testable import LucideSwiftfor internal access - Test all public API surface
- Include edge cases for parser logic
- Track library version in
.library-version(auto-increments patch on icon sync) - Track upstream Lucide version in
.lucide-version - Commit messages: concise, imperative mood
- Generated code updates go in separate commits
- IMPORTANT: You are not allowed to commit until explicitly instructed to do so. If you find the current working directory worth committing before proceeding, let the user know and wait for a decision.
- LucideShape: Shape protocol implementation for SVG rendering.
- LucideIcon: SwiftUI View wrapper for all icons — supports
.strokedand.filledstyles viaLucideIconStyle, and handles both regular and Lab icons through a unified interface. - LucideGenerator: Fetches icons from both
lucideandlucide-labrepositories and generates Swift code.
M/m: Move toL/l: Line toH/h: Horizontal lineV/v: Vertical lineC/c: Cubic bezier curveZ/z: Close pathQ/q: Quadratic bezier curve (supported via conversion)T/t: Smooth quadratic curve (supported via conversion)S/s: Smooth cubic curve (supported via conversion)A/a: Elliptical arc (supported via conversion)
Sources/
├── LucideSwift/
│ ├── LucideIcon.swift # Unified icon View + Label extensions
│ ├── Lucide.swift # LucideShape definition
│ ├── Image+Lucide.swift # Image extensions for rasterized icons
│ ├── Lucide+Generated.swift # Auto-generated icons (DO NOT EDIT)
└── LucideGenerator/
├── main.swift # Code generation tool
└── SVGPathParser.swift # SVG parsing logic
- Dual versioning: Library version is independent from upstream Lucide version
- Library Version: Tracked in
.library-versionfile (e.g.,0.1.0), auto-increments patch on icon updates - Upstream Version: Tracked in
.lucide-version(e.g.,1.7.0) - Lab Version: Tracked in
.lucide-lab-version - Access programmatically via
LucideVersions
The .github/workflows/sync-and-release.yml runs daily to:
- Check upstream Lucide releases
- If new version available:
- Run
swift run LucideGenerator - Auto-increment patch version in
.library-version(e.g., 0.1.0 → 0.1.1) - Commit generated files
- Create git tag and GitHub release
- Run
- If no update: skip silently
For breaking changes or new features:
- Manually update
.library-version(e.g., 0.1.5 → 0.2.0) - Commit the change
- Create tag manually:
git tag -a 0.2.0 -m "Release 0.2.0" - Push tag:
git push origin 0.2.0 - GitHub release is created automatically by the workflow
- Lucide Icons: https://lucide.dev
- Upstream repo: https://github.com/lucide-icons/lucide b.com/lucide-icons/lucide