Check image files and resources for Swift
From 2.0 version we support SPM plugin.
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler. Imagelinter
supports its use on supported platforms as plugin tool.
Once you have your Swift package set up, adding Imagelinter
as a dependency is as easy as adding it to the dependencies
value of your Package.swift
. Then you need call from your target plugin like this:
dependencies: [
.Package(url: "https://github.com/ByteriX/Imagelinter.git", majorVersion: 2)
],
targets: [
.target(
name: "YourTarget",
plugins: [
.plugin(name: "ImagelinterPlugin", package: "Imagelinter"),
]
)
]
${SRCROOT}/ImageLinter.swift -imagesPath "/YouProject/Resources/Images" -sourcePath "/YouProject/Source"
You need to add a settings file named imagelinter.yaml
or/and imagelinter.yml
to a target
or/and the root of the library
dir
of the package.
imagesPath and sourcePath are calculated from dir of this package.
Supports more settings files with rewrite properties with priority: first a target
then the root of library
dir, first
imagelinter.yamlthen
imagelinter.yml`.
isEnabled: true
relativeImagesPath: /Sources/Images/Resources
relativeSourcePath: /Sources/Images
usingTypes:
- case: uiKit
- case: swiftUI
- case: swiftGen
enumName: Asset
- case: custom
pattern: "(.*)".name
isSwiftGen: true
- case: custom
pattern: "(.*)".image
ignoredUnusedImages:
- temp
ignoredUndefinedImages:
- temp
rastorExtensions:
- png
- jpg
- jpeg
vectorExtensions:
- pdf
- svg
sourcesExtensions:
- swift
- mm
resourcesExtensions:
- storyboard
- xib
isAllFilesErrorShowing: false
maxVectorFileSize: 10000
maxVectorImageSize:
width: 100
height: 100
maxRastorFileSize: 300000
maxRastorImageSize:
width: 300
height: 300
isCheckingFileSize: true
isCheckingImageSize: true
isCheckingPdfVector: true
isCheckingSvgVector: true
isCheckingScaleSize: true
isCheckingDuplicatedByName: true
isCheckingDuplicatedByContent: true
targetPlatforms:
- iOS
- iPadOS
- macOS
- tvOS
- visionOS
- watchOS
You can review