SlaticoIcons (SwiftPM) · v0.1.0
Apple Native (SwiftUI, UIKit & AppKit) Guide
The SlaticoIcons Swift Package provides a zero-dependency CoreGraphics CGPath vector renderer across iOS 15+, iPadOS 15+, macOS 12+, tvOS 15+, and watchOS 8+ for all 27 Slatico icon families and 189 style variants (plus 189 bundled SVG resources in Bundle.module).
1. Swift Package Manager (Package.swift)
Package.swift
// 1. Local monorepo path dependency (packages/swift/Package.swift):
dependencies: [
.package(path: "../slatico/packages/swift")
],
targets: [
.target(
name: "YourApp",
dependencies: [
.product(name: "SlaticoIcons", package: "SlaticoIcons")
]
)
]
// 2. Or standalone Swift release mirror repository:
// .package(url: "https://github.com/infitusofficial/slatico-swift.git", from: "0.1.0")2. SwiftUI (SlaticoIcon & Environment Modifiers)
ContentView.swift
import SwiftUI
import SlaticoIcons
struct ContentView: View {
var body: some View {
HStack(spacing: 16) {
// 1. Regular monochrome icon (defaults to size = 24, Color.primary)
SlaticoIcon(.bell, style: .regular, size: 24)
// 2. Customized sizing and explicit monochrome color
SlaticoIcon(
.arrowUpRight,
style: .bold,
size: 32,
color: Color(red: 0.004, green: 0.020, blue: 0.125),
accessibilityLabel: "Open Link"
)
// 3. Duotone icon with custom primary color, secondaryColor & secondaryOpacity
SlaticoIcon(
.shieldCheck,
style: .duotone,
size: 28,
color: Color(red: 0.004, green: 0.020, blue: 0.125),
secondaryColor: Color(red: 1.0, green: 0.376, blue: 0.251),
secondaryOpacity: 0.25,
accessibilityLabel: "Security Verified"
)
// 4. Color icon with default brand palette (#FF6040 primary + #000000 secondary)
SlaticoIcon(.wallet, style: .color, size: 28, accessibilityLabel: "Wallet")
// 5. Color icon with two custom colors (color + secondaryColor)
SlaticoIcon(
.bell,
style: .color,
size: 28,
color: Color(red: 1.0, green: 0.376, blue: 0.251),
secondaryColor: Color(red: 0.004, green: 0.020, blue: 0.125),
accessibilityLabel: "Notifications"
)
}
}
}3. UIKit (UIImage.slatico) & AppKit (NSImage.slatico)
PlatformRenderers.swift
import SlaticoIcons
#if canImport(UIKit)
import UIKit
// 1. Monochrome template UIImage (uses .alwaysTemplate when color is nil)
let bellTemplate = UIImage.slatico(.bell, style: .regular, size: 24)
// 2. Duotone UIImage with custom primary & secondary UIColor
let duotoneImage = UIImage.slatico(
.shieldCheck,
style: .duotone,
size: 28,
color: UIColor(red: 0.004, green: 0.020, blue: 0.125, alpha: 1.0),
secondaryColor: UIColor(red: 1.0, green: 0.376, blue: 0.251, alpha: 1.0),
secondaryOpacity: 0.25
)
// 3. Color UIImage with two custom colors
let colorImage = UIImage.slatico(
.wallet,
style: .color,
size: 28,
color: UIColor(red: 1.0, green: 0.376, blue: 0.251, alpha: 1.0),
secondaryColor: .black
)
#endif
#if canImport(AppKit)
import AppKit
// macOS AppKit resolution-independent NSImage
let macIcon = NSImage.slatico(
.arrowUpRight,
style: .duotone,
size: 24,
color: .labelColor,
secondaryColor: .systemOrange,
secondaryOpacity: 0.25
)
#endif4. Complete Parameter Reference (SlaticoIcon / UIImage.slatico / NSImage.slatico)
| Parameter | Type | Default | Description |
|---|---|---|---|
| _ name / icon | SlaticoIconName | required | CamelCase enum case (.bell, .shieldCheck, .arrowUpRight). |
| style | SlaticoStyle? | .regular | Visual style (.thin, .light, .regular, .bold, .fill, .duotone, .color). |
| size | CGFloat? | 24.0 | Width and height in points. |
| color | Color? / UIColor? / NSColor? | .primary (#FF6040 in .color) | Primary foreground color for monochrome, .duotone, and .color styles. |
| secondaryColor | Color? / UIColor? / NSColor? | color (#000000 in .color) | Secondary tone color for .duotone and .color styles. |
| secondaryOpacity | Double? / CGFloat? | 0.2 (authored SVG) | Secondary layer opacity (0.0...1.0) for .duotone icons. |
| accessibilityLabel | Text? / String? | nil | VoiceOver accessibility label (SwiftUI). When nil, applies .accessibilityHidden(true). |