isapozhnik/hugeicons-swift
> [!NOTE]
For Developers (Using Icons)
Use the generated namespace:
Hugeicons.arrowDownLeft01Hugeicons.repeatIcon(keyword-safe)Hugeicons.all
Installation (Developers)
Add the package with Swift Package Manager.
Xcode:
File->Add Package Dependencies...- Enter this repository URL
- Add product
Hugeiconsto your target
Package.swift:
dependencies: [
.package(url: "https://github.com/isapozhnik/hugeicons-swift.git", from: "1.0.0")
],
targets: [
.target(
name: "YourTarget",
dependencies: [
.product(name: "Hugeicons", package: "hugeicons-swift")
]
)
]Then import in app code:
import HugeiconsUsage
Basic icon rendering:
Hugeicons.addTeam.image()Toolbar action:
struct EditorView: View {
var body: some View {
Text("Document")
.toolbar {
ToolbarItem(placement: .primaryAction) {
Button(action: syncNow) {
Hugeicons.refresh.image()
}
.help("Sync now")
}
}
}
private func syncNow() {}
}List/sidebar row icon:
List {
HStack(spacing: 8) {
Hugeicons.mail01.image()
Text("Inbox")
}
HStack(spacing: 8) {
Hugeicons.sent.image()
Text("Sent")
}
}State-driven icon:
let icon = isMuted ? Hugeicons.volumeMute01 : Hugeicons.volumeHigh
icon.image()
.foregroundStyle(isMuted ? .secondary : .primary)Persist and restore by stable identifier:
let persistedID = Hugeicons.textCheck.swiftIdentifier
let restoredIcon = Hugeicons.asset(swiftIdentifier: persistedID)AppKit menu item:
let item = NSMenuItem(title: "Settings", action: #selector(openSettings), keyEquivalent: ",")
item.image = Hugeicons.settings01.nsImage()
?? NSImage(systemSymbolName: "gearshape", accessibilityDescription: nil)Notes:
image()is non-optional and fails fast if the icon resource is missing.nsImage()anduiImage()are optional and can be used for defensive flows.
For Maintainers (Pipeline and Updates)
Important: the npm payload does not ship raw .svg files. It ships icon modules in dist/esm/*Icon.js, and the fetch script converts those modules into PDF-backed .imageset entries in Hugeicons.xcassets.
Installation (Maintainers)
Clone and enter repository:
git clone https://github.com/<org>/hugeicons-swift.git
cd hugeicons-swiftInstall required tooling (macOS/Homebrew):
brew install node swiftgen
npm ciVerify tooling:
node --version
npm --version
swiftgen --version
swift --versionBuild once:
swift buildDependencies
Required tools:
- Node.js + npm (used by
npm packand the JS converter) - SwiftGen CLI (used to generate
Assets+Generated.swift) - npm dev dependencies from
package.json(install withnpm ci)
Generated artifacts
- Asset catalog payload:
- Sources/Hugeicons/Resources/Hugeicons/Hugeicons.xcassets/.imageset/.pdf - Sources/Hugeicons/Resources/Hugeicons/Hugeicons.xcassets/conversion-report.json
- Metadata artifact:
- Sources/Hugeicons/Resources/Hugeicons/name-map.json
- Swift API artifacts:
- Sources/Hugeicons/Generated/Assets+Generated.swift (SwiftGen output, machine-owned) - Sources/Hugeicons/Generated/Hugeicons+Catalog.generated.swift (wrapper catalog, machine-owned)
Scripts
Run commands from repository root.
- Fetch free Hugeicons asset catalog
- Script:
Scripts/icons/fetch_hugeicons_free.sh - Usage:
Scripts/icons/fetch_hugeicons_free.sh [--version-lock <path>] [--output-dir <path>]
- Verify generated asset catalog
- Script:
Scripts/icons/verify_hugeicons_xcassets.swift - Usage:
Scripts/icons/verify_hugeicons_xcassets.swift <xcassets-root-dir> [--report-path <path>] [--max-skipped <count>]
- Generate stable Swift name map
- Script:
Scripts/icons/generate_hugeicons_name_map.swift - Usage:
Scripts/icons/generate_hugeicons_name_map.swift <xcassets-root-dir> <name-map-output-path>
- Generate Swift wrappers
- Script:
Scripts/icons/generate_hugeicons_swift_api.sh - Runs:
1. swiftgen config lint --config swiftgen.yml 2. swiftgen config run --config swiftgen.yml 3. Scripts/icons/generate_hugeicons_wrapper.swift ...
- One-command refresh
- Script:
Scripts/icons/update_hugeicons_free.sh - Runs:
1. fetch 2. verify asset catalog 3. regenerate name map + Swift wrapper API 4. print added/removed/renamed summary
Standard refresh flow
- Set pinned version in
version.lock. - Run
Scripts/icons/update_hugeicons_free.sh.
Package Metadata
Repository: isapozhnik/hugeicons-swift
Default branch: main
README: README.md