Skip to content

StefKors/FileIconKit

Repository files navigation

FileIconKit

Supported Platforms

Swift extensions for retrieving file icons and path metadata on macOS. Get effective, custom, or resolved icons for any file URL, plus convenient String helpers for extracting file names and extensions.

Install

Add to your Package.swift:

dependencies: [
    .package(url: "https://github.com/StefKors/FileIconKit.git", from: "1.0.0")
]

Usage

import FileIconKit

let url = URL(fileURLWithPath: "/Applications/Safari.app")

// Get the resolved icon (custom icon if set, otherwise effective icon)
if let icon = url.resolvedIcon {
    // Use the NSImage
}

// String path helpers
let name = "/path/to/file.pdf".fileName()       // "file"
let ext = "/path/to/file.pdf".fileExtension()    // "pdf"

API

URL Extensions (macOS only)

Property Type Description
effectiveIcon NSImage? System-determined icon for the file
customIcon NSImage? Custom icon set on the file, if any
resolvedIcon NSImage? Custom icon, falling back to effective icon
contentAccessDate Date? Last access date of the file

String Extensions

Method Returns Description
fileName() String File name without extension
fileExtension() String File extension

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages