Topic

Migrating to Saga 4

Saga 4 adds item resources, and removes the APIs that were deprecated in Saga 3.

What’s new

Breaking changes

Important These changes will require updates to your code.

  • metadata: is required. Saga’s default for this parameter relies on behavior that a future Swift language mode will turn into an error, so every register call now needs an explicit metadata: argument. Pass EmptyMetadata.self where you relied on the default.
  • ItemRenderingContext.resources is removed. Use context.item.resources instead. Each resource is a Resource rather than a path, so link to it with its url.
  • With i18n, hashed(_:) now takes the file’s path in the output folder rather than the input folder. For example /articles/chart.png rather than /en/articles/chart.png, or /nl/artikelen/chart.png rather than /nl/articles/chart.png. Files outside locale folders, like /static/style.css, are unaffected.
  • Deprecated APIs are removed:

Update your dependencies

In your Package.swift, bump the Saga dependency:

// Before
.package(url: "https://github.com/loopwerk/Saga", from: "3.0.0"),

// After
.package(url: "https://github.com/loopwerk/Saga", from: "4.0.0"),