You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Xcode asset catalog generator for Swift/UIKit using Phosphor icons
If you haven't yet migrated to SwiftUI, you may prefer to stick with PNG's (rather than SVG's) for your Xcode asset catalogs.
phosphor-uikit.py is a script which uses Phosphor icons to generate PNG-based asset catalogs for Xcode based on JSON configuration files.
Demo
The above will generate Icon.swift:
// Generated by phosphor-uikit.py. Edits will be clobbered by the next run.
import UIKit
/// Phosphor icons.
enumIcon:String,Equatable,Hashable,CaseIterable{case house25Fill ="house.25.fill"case house25 ="house.25.regular"case magnifyingGlass25Fill ="magnifying-glass.25.fill"case magnifyingGlass25 ="magnifying-glass.25.regular"}extensionIcon{varimage:UIImage{returnUIImage(named: rawValue)!
}}extensionUIImage{convenienceinit(icon:Icon){self.init(named: icon.rawValue)!
}}
The above would be used like so:
letimage=UIImage(icon:.house25)
Installation
phosphor-uikit.py relies on rsvg-convert to rasterize SVG files. Install it with brew install librsvg.
phosphor-uikit.py itself has no Python dependencies. Simply download and call it.