Skip to content

Releases: botforge-pro/swift-embed

v1.5.0 - Caching and Swift 6 Improvements

20 Sep 21:43

Choose a tag to compare

What's New

🚀 Features

  • Automatic caching - All resource loading methods now use NSCache for automatic caching
  • Swift 6 support - Full compatibility with Swift 6 strict concurrency checking
  • Shared cache - Property wrappers and direct methods share the same cache

📚 Documentation

  • New recommended pattern: computed properties for static resources
  • Examples for Swift 6 compatibility
  • Comprehensive caching behavior documentation

🐛 Bug Fixes

  • Fixed property wrappers to use cached loading methods
  • Removed redundant code paths

🧹 Code Quality

  • Zero compiler warnings
  • Zero SwiftLint violations
  • Removed all dead code
  • Added comprehensive tests for caching behavior

Usage

For Swift 6 compatibility, use computed properties:

struct AppConfig {
    static var config: Config {
        Embedded.getJSON(Bundle.main, path: "config.json")
    }
}

Installation

dependencies: [
    .package(url: "https://github.com/botforge-pro/swift-embed.git", from: "1.5.0")
]

v1.4.0

20 Sep 15:27

Choose a tag to compare

Swift 6 Compatibility Release

Breaking Changes

  • Renamed property wrapper types to follow Swift naming conventions:
    • @Embedded.json@Embedded.JSON
    • @Embedded.yaml@Embedded.YAML
    • @Embedded.text@Embedded.Text

Features

  • Full Swift 6.0 compatibility
  • Sendable conformance for property wrappers
  • No global mutable state warnings

Improvements

  • Fixed static methods to work without property wrappers
  • Added SwiftLint configuration
  • Fixed all linting issues

SwiftEmbed 1.3.1

26 Aug 20:48

Choose a tag to compare

  • Add text file support
  • Update installation version in README
  • Add documentation about using .copy() for resources

SwiftEmbed 1.2.0

21 Aug 19:17

Choose a tag to compare

Breaking Changes

  • Bundle is now the first parameter without label
  • Removed default Bundle.main - must be explicit

New API

// Property wrappers
@Embedded.json(Bundle.main, path: "file.json")
@Embedded.yaml(Bundle.module, path: "file.yaml")

// Direct loading
Embedded.getJSON(Bundle.main, path: "file.json", as: [User].self)
Embedded.getYAML(Bundle.module, path: "file.yaml", as: Config.self)

Migration

Change from:

  • @Embedded.json("file.json", bundle: Bundle.module)
  • Embedded.getJSON("file.json", bundle: Bundle.module, as: T.self)

To:

  • @Embedded.json(Bundle.module, path: "file.json")
  • Embedded.getJSON(Bundle.module, path: "file.json", as: T.self)

SwiftEmbed 1.1.0

21 Aug 18:46

Choose a tag to compare

New Features

  • Added Embedded.getJSON() and Embedded.getYAML() for direct loading
  • Useful for Swift Testing parametrized tests
  • Useful for immediate resource loading without property wrappers

Usage

// Direct loading
let users = Embedded.getJSON("users.json", as: [User].self)

// In tests
@Test("Validation", arguments: Embedded.getJSON("tests.json", as: [TestCase].self))
func test(testCase: TestCase) { }

Compatibility

  • Swift 5.9+
  • All platforms

SwiftEmbed 1.0.0

21 Aug 18:24

Choose a tag to compare

Initial release

Features

  • JSON resource embedding with @Embedded.json
  • YAML resource embedding with @Embedded.yaml
  • Type-safe Decodable support
  • Bundle support for tests and frameworks
  • Swift 5.9+ compatibility