No description
Find a file
autocommit 350f3a60a1
Some checks failed
Build and Publish / build-and-publish (push) Failing after 43s
deps-upgrade(dependencies): ⬆️ Update dependencies to latest minor/patch versions
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-06-10 04:12:38 -07:00
.forgejo/workflows chore: initial commit 2026-01-21 12:00:53 -08:00
ci chore: initial commit 2026-01-21 12:00:53 -08:00
makefiles chore: initial commit 2026-01-21 12:00:53 -08:00
scripts chore: initial commit 2026-01-21 12:00:53 -08:00
swiftlint chore: initial commit 2026-01-21 12:00:53 -08:00
package.json deps-upgrade(dependencies): ⬆️ Update dependencies to latest minor/patch versions 2026-06-10 04:12:38 -07:00
README.md chore: trigger CI publish 2026-01-30 11:55:42 -08:00

@lilith/swift-tooling

Shared Swift development tooling for Lilith Platform projects.

Contents

@swift/
├── swiftlint/
│   ├── base.yml          # Core SwiftLint rules
│   └── macos-app.yml     # macOS app-specific rules
├── makefiles/
│   └── base.mk           # Makefile with lint, build, test targets
├── ci/
│   └── gitlab-swift-lint.yml  # GitLab CI template (Linux Docker)
└── scripts/
    └── install-tools.sh  # Install SwiftLint/SwiftFormat

Quick Start

1. Install Tools (macOS)

./scripts/install-tools.sh
# Or manually:
brew install swiftlint swiftformat

2. Add to Your Swift Project

Create .swiftlint.yml in your project:

parent_config: ~/Code/@packages/@swift/swiftlint/macos-app.yml

# Project-specific overrides (optional)
excluded:
  - .build
  - DerivedData

Create Makefile:

SWIFT_PACKAGE_NAME = YourAppName
include ~/Code/@packages/@swift/makefiles/base.mk

3. Use Make Targets

make help          # Show all targets
make lint          # Run SwiftLint
make lint-fix      # Auto-fix lint issues
make build         # Build debug
make build-release # Build release
make test          # Run tests
make clean         # Clean build artifacts

GitLab CI Integration

Add to your .gitlab-ci.yml:

your-app:swift-lint:
  stage: test
  image: ghcr.io/realm/swiftlint:0.54.0
  script:
    - cd path/to/swift/project
    - swiftlint lint --config .swiftlint.yml --strict
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
      changes:
        - path/to/swift/project/**/*.swift

SwiftLint Rules

Base Rules (base.yml)

  • Force cast/try/unwrap detection
  • Sorted imports
  • Closure spacing and formatting
  • Function parameter limits (6 warn, 8 error)
  • Cyclomatic complexity (10 warn, 20 error)
  • No print() statements (use NSLog/os.Logger)

macOS App Rules (macos-app.yml)

Extends base with:

  • Accessibility label requirements
  • Private outlet enforcement
  • Async/await preference over DispatchQueue
  • Stricter nesting limits

Linux Compatibility

Tool Linux Notes
SwiftLint Yes Docker or manual install
SwiftFormat Yes Requires Swift toolchain
swift build Partial macOS frameworks unavailable
swift test No Tests need macOS APIs

Custom Rules

The collective enforces these project conventions:

  1. No print() - Use NSLog() or os.Logger for production
  2. Prefer async/await - Over DispatchQueue.async
  3. Avoid force unwrap - Use guard/if-let

Updating

To update SwiftLint rules across all projects, edit the configs in this package. Projects using parent_config will automatically pick up changes.


Lilith Platform Swift Tooling v1.0.0