Check image files and resources for Swift
- Checking size of vector(PDF) and rastor(PNG/JPEG) files
- Catch raster from PDF
- Checking unused image files
- Search undefined images
- Comparing scaled images size
- Checking duplicate images by name
- Checking duplicate images by content (but identical)
- Search empty and broken asset images
- Analysis scales of images with dependency on platforms target
- Possible analyse the sources (swift, Objective-C files) and resources (Storyboard, xib files)
- Support Assets and files with @Xx notation
- vector/rastor diffenition and you can limit use formats by PNG, JPG, PDF, SVG, etc formats
- Support any use notation: SwiftUI, UIKit, SwiftGen, and custom Regex
- You can ignore any images
- Any settings for generation errors or warnings
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"),
]
)
]
- Just copy ImageLinter.swift to project.
- Exclude from "Build Phases" -> "Compile Sources"
- Add to "Build Phases" run script:
${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