Agent skills for iOS, iPadOS, Swift, SwiftUI, and modern Apple framework development.
71
89%
Does it follow best practices?
Impact
—
No eval scenarios have been run
Advisory
Suggest reviewing before use
Detailed guidance on installing SwiftLint, configuring .swiftlint.yml, and rolling out linting in existing codebases.
| Method | When to use |
|---|---|
| SwiftLintPlugins SPM package | Default for any project with Package.swift. Pins version automatically. |
Homebrew (brew install swiftlint) | CI runners, pre-commit hooks, standalone CLI usage. |
Mint (mint install realm/SwiftLint) | Teams using Mint for tool management. |
CocoaPods (pod 'SwiftLint') | Legacy projects already using CocoaPods. Binary is at ${PODS_ROOT}/SwiftLint/swiftlint. |
| Pre-built binary | Download from GitHub releases. Useful for controlled CI environments. |
The build tool plugin (via SwiftLintPlugins) is recommended over all other local integration methods. See the plugins and integrations reference linked from SKILL.md for setup details.
SwiftLint treats the top-level .swiftlint.yml as the main configuration, then optionally merges the nearest nested .swiftlint.yml found while walking up from an individual file.
.swiftlint.yml is merged for any given file.--config overrides automatic discovery entirely and disables nested-config lookup.Working directory behavior:
.swiftlint.yml within the package/project directory as its working directory, and falls back to the package/project root if no config file is found there.${SRCROOT} or the Xcode build setting for the working directory.# Enable defaults minus these:
disabled_rules:
- trailing_whitespace
- todo
# Add these on top of defaults:
opt_in_rules:
- empty_count
- closure_spacing
- sorted_imports
- vertical_whitespace_opening_braces
- contains_over_filter_count
- first_where
- last_where
- modifier_orderonly_rules is mutually exclusive with disabled_rules and opt_in_rules. Use it only when you want to start from an empty rule set and explicitly list every rule:
only_rules:
- line_length
- force_cast
- force_tryAnalyzer rules require passing compiler logs to SwiftLint. They are not included in default or opt-in sets:
analyzer_rules:
- unused_import
- unused_declarationSee the custom rules and analyze reference linked from SKILL.md.
included:
- Sources
- Tests
excluded:
- .build
- DerivedData
- Carthage
- Pods
- "**/Generated"
- "**/Snapshots"included and excluded support glob patterns. Paths are relative to the config file's directory.
reporter: xcode # default — Xcode-compatible warnings/errors
# reporter: json
# reporter: sarif
# reporter: checkstyle
# reporter: csv
# reporter: emoji
# reporter: github-actions-loggingUse sarif for GitHub code scanning integration. Use json for custom tooling. Use github-actions-logging for inline PR annotations without SARIF upload.
strict: true # all warnings become errors
# lenient: true # all errors become warnings (useful during initial adoption)
allow_zero_lintable_files: true # don't error when no .swift files are found (useful in CI)Most rules accept warning and error thresholds:
line_length:
warning: 140
error: 200
ignores_comments: true
ignores_urls: true
ignores_interpolated_strings: true
type_body_length:
warning: 300
error: 500
file_length:
warning: 500
error: 1000
ignore_comment_only_lines: true
function_body_length:
warning: 50
error: 100
cyclomatic_complexity:
warning: 10
error: 20
ignores_case_statements: true
nesting:
type_level: 2
function_level: 3
identifier_name:
min_length:
warning: 2
error: 1
max_length:
warning: 50
error: 60
excluded:
- id
- x
- y
- i
- j
- toCheck available configuration keys for any rule with swiftlint rules <rule_name> or the rule directory.
Configuration values can reference environment variables:
included:
- ${PROJECT_DIR}/Sources
excluded:
- ${PROJECT_DIR}/GeneratedThis is useful when SwiftLint is invoked from different working directories (e.g., run scripts vs CLI).
SwiftLint supports both explicit parent/child config chaining and automatic nested configs.
Use child_config and parent_config to layer configs deliberately:
# .swiftlint.yml
child_config: .swiftlint-strict.yml
parent_config: Base/.swiftlint-base.ymlchild_config refines the current config with higher priority. parent_config provides lower-priority defaults.
A .swiftlint.yml in a subdirectory can also act as a nested child config for files in that subtree:
MyProject/
├── .swiftlint.yml # root config
├── Sources/
│ └── .swiftlint.yml # stricter config for production code (optional)
└── Tests/
└── .swiftlint.yml # relaxed config for test codeExample child config for tests:
# Tests/.swiftlint.yml
disabled_rules:
- force_unwrapping
- force_try
- force_cast
file_length:
warning: 800
error: 1500
function_body_length:
warning: 100
error: 200Rule state from parent and child configs is merged. A child config only overrides the parent when it explicitly states the opposite for the same rule. For example, a parent disabled_rules entry still applies unless the child opt-ins that same rule, and a parent opt-in still applies unless the child disables it.
For included and excluded, SwiftLint applies special merge behavior: paths are resolved relative to each config file, child excluded entries can remove parent included entries, and child included entries can re-include paths excluded by the parent.
Nested configs are only used when SwiftLint discovers configs automatically. If you pass --config, nested discovery is disabled.
Pass multiple configs via CLI. Later configs override earlier ones:
swiftlint --config .swiftlint.yml --config .swiftlint-strict.ymlPull a shared team configuration using parent_config with an HTTPS URL:
parent_config: https://example.com/team-swiftlint.yml
remote_timeout: 2 # seconds, default is 2
remote_timeout_if_cached: 1 # seconds, used when a cached version existsRemote configs are cached locally. If the fetch fails or times out, the cached version is used. If no cache exists and the fetch fails, SwiftLint fails with an error.
Caution: Remote configs introduce a network dependency. Ensure CI runners can reach the URL, or use a local copy as a fallback.
Adopting SwiftLint in an existing project without disrupting the team:
swiftlint --reporter json | python3 -m json.tool | head -50swiftlint --write-baseline .swiftlint.baseline--baseline .swiftlint.baseline.swiftlint --strict --baseline .swiftlint.baseline — no new violations allowed.--fix in CI or build phases.--strict in CI, build tool plugin in local builds.unused_import.skills
accessorysetupkit
references
activitykit
references
adattributionkit
references
alarmkit
references
app-clips
app-intents
references
app-store-optimization
app-store-review
apple-on-device-ai
appmigrationkit
references
audioaccessorykit
references
authentication
references
avkit
references
background-processing
references
browserenginekit
references
callkit
references
carplay
references
cloudkit
references
contacts-framework
references
core-bluetooth
references
core-data
core-motion
references
core-nfc
references
coreml
references
cryptokit
references
cryptotokenkit
references
debugging-instruments
device-integrity
references
dockkit
references
energykit
references
eventkit
references
financekit
references
focus-engine
gamekit
references
healthkit
references
homekit
references
ios-accessibility
ios-localization
ios-networking
ios-simulator
references
mapkit
metrickit
references
musickit
references
natural-language
references
paperkit
references
passkit
references
pdfkit
references
pencilkit
references
permissionkit
references
photokit
push-notifications
realitykit
references
relevancekit
references
scenekit
references
sensorkit
references
speech-recognition
spritekit
references
storekit
swift-api-design-guidelines
swift-architecture
swift-charts
references
swift-codable
swift-concurrency
swift-formatstyle
swift-language
swift-security
references
swift-testing
swiftdata
swiftlint
swiftui-animation
swiftui-gestures
references
swiftui-layout-components
swiftui-liquid-glass
references
swiftui-patterns
swiftui-performance
swiftui-uikit-interop
swiftui-webkit
tabletopkit
references
tipkit
references
vision-framework
weatherkit
references
widgetkit
references