Skip to content

v0.9.0: SVG Integration and Major Enhancements

Choose a tag to compare

@coenttb coenttb released this 26 Sep 20:23

🎉 Major Release: Native SVG Support

This release brings first-class SVG support to swift-html through integration with the new swift-svg ecosystem.

What's New

🎨 Native SVG Integration

  • Swift-SVG Integration: Added dependency on swift-svg for type-safe SVG generation
  • Modern SVG API: New SVGIntegration module providing seamless HTML/SVG interoperability
  • Legacy Compatibility: Existing SVG.swift renamed to LegacySVG.swift to preserve backward compatibility

🚀 New SVG Capabilities (Preview)

  • SVG Convenience Methods: Comprehensive helper methods for common SVG patterns (currently disabled for refinement)
  • SVG Icon Library: Extensive collection of pre-defined SVG icons (currently disabled for refinement)
  • These features are included but disabled (.disabled extension) while we refine the API

🛠️ Component Improvements

  • Enhanced Favicons: Improved SVG generation with better type safety for favicon components
  • Label Component: Fixed accessibility attributes and styling consistency
  • Navigation Bar: Enhanced responsiveness and SVG logo support
  • HTML Markdown: Improved diagnostics and error handling

🧪 Testing

  • SVG Integration Tests: Comprehensive test suite for SVG/HTML integration
  • Dark Mode Tests: Fixed compatibility issues with color dark mode testing

📦 Infrastructure

  • Swift 6.0 Compatibility: Updated package configuration for Swift 6.0
  • Dependency Management: Cleaned up Package.swift with better dependency definitions
  • Package Structure: Improved module organization for better maintainability

Breaking Changes

  • The existing SVG type in HTML Enhancements has been renamed to LegacySVG
  • New SVG functionality requires the swift-svg dependency

Migration Guide

For existing SVG usage:

// Old (still works with LegacySVG)
import HTML
let svg = SVG { ... } // Now uses LegacySVG internally

// New (recommended)
import HTML
import SVG
let svg = SVG(width: 100, height: 100) {
    Circle(cx: 50, cy: 50, r: 40)
        .fill("blue")
}

For favicon components:

The Favicons component now has improved SVG type safety. Update your favicon initialization to use the new SVG type.

Installation

dependencies: [
    .package(url: "https://github.com/coenttb/swift-html.git", from: "0.9.0")
]

Dependencies Added

  • swift-svg v0.1.0 - Type-safe SVG generation

Coming Soon

The disabled SVG convenience methods and icon library will be enabled in a future release once the API is finalized.

Full Changelog: 0.8.1...0.9.0