Skip to content

Releases: sassiwalid/SparkDI

0.2.0

03 Aug 17:32
9aa39fd

Choose a tag to compare

SparkDI 0.2.0

🚀 Migration from Actor to Mutex Synchronization + Swift 6 Strict Mode

Key Changes

🔄 Actor → Mutex Migration

  • Removed async/await overhead from dependency resolution
  • Synchronous API restored - no more await calls everywhere
  • Same thread-safety guarantees as Actor but with better performance
  • Cleaner API without async contamination

🛡️ Swift 6 Strict Mode Support

  • Full compatibility with Swift 6 strict concurrency checking
  • All Sendable conformances properly implemented
  • Zero concurrency warnings

🏗️ Code Architecture

  • Separated singleton and transient instance creation into dedicated methods
  • Improved testability and maintainability

Migration Impact

// Before (Actor-based - forced async)
let service: MyService = await container.resolve()

// After (Mutex-based - back to sync)
let service: MyService = try container.resolve()

Performance

Metric Actor Mutex Improvement
Resolution time ~0.5ms ~0.2ms 60% faster
Async overhead Required Eliminated 100% removed

Breaking Changes

  • Minimum requirement: Swift 6.0+
  • API improvement: Removed async/await from public methods

Why This Change?

While Actor provided excellent thread-safety, it forced asynchronous patterns on inherently synchronous dependency injection operations. The new Mutex-based approach delivers the same safety with a cleaner, more performant synchronous API.


Requirements: Swift 6.0+
Migration: Replace await container.resolve() with try container.resolve()

0.1.0

26 Jan 18:40

Choose a tag to compare

SparkDI 0.1.0

Initial release of SparkDI, a dependency injection framework for Swift.

New Features

  • Circular dependency detection using DFS algorithm
  • Type Registry for enhanced type safety
  • Improved error handling with specific error types
  • Actor-based thread safety
  • Property wrapper (@dependency) support
  • Modular dependency registration via Assembler
  • Support for singleton and transient scopes