From 8f14a9eda15fef9f7153211f98cf446e18859713 Mon Sep 17 00:00:00 2001 From: Shane Friedman Date: Sun, 16 Nov 2025 18:56:52 -0500 Subject: [PATCH 1/2] Allow async onCreatePublication callbacks --- Sources/Shared/Publication/Publication.swift | 6 +++--- Sources/Streamer/PublicationOpener.swift | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Shared/Publication/Publication.swift b/Sources/Shared/Publication/Publication.swift index daf5c44e9..6045c8123 100644 --- a/Sources/Shared/Publication/Publication.swift +++ b/Sources/Shared/Publication/Publication.swift @@ -169,7 +169,7 @@ public class Publication: Closeable, Loggable { _ manifest: inout Manifest, _ container: inout Container, _ services: inout PublicationServicesBuilder - ) -> Void + ) async -> Void private var manifest: Manifest private var container: Container @@ -185,12 +185,12 @@ public class Publication: Closeable, Loggable { self.servicesBuilder = servicesBuilder } - public mutating func apply(_ transform: Transform?) { + public mutating func apply(_ transform: Transform?) async { guard let transform = transform else { return } - transform(&manifest, &container, &servicesBuilder) + await transform(&manifest, &container, &servicesBuilder) } /// Builds the `Publication` from its parts. diff --git a/Sources/Streamer/PublicationOpener.swift b/Sources/Streamer/PublicationOpener.swift index 2af9d5670..f9db6c90e 100644 --- a/Sources/Streamer/PublicationOpener.swift +++ b/Sources/Streamer/PublicationOpener.swift @@ -93,7 +93,7 @@ public class PublicationOpener { switch await parser.parse(asset: asset, warnings: warnings) { case var .success(builder): for transform in builderTransforms { - builder.apply(transform) + await builder.apply(transform) } return .success(builder.build()) From 03b280d7fdff7b410e852d75a6980b5ee1385977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mickae=CC=88l=20Menu?= Date: Mon, 24 Nov 2025 10:29:52 +0100 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f8aa9f52..2955e69ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ All notable changes to this project will be documented in this file. Take a look * This callback is called before executing any navigation action. * Useful for hiding UI elements when the user navigates, or implementing analytics. +### Changed + +#### Streamer + +* Support for asynchronous callbacks with `onCreatePublication` (contributed by [@smoores-dev](https://github.com/readium/swift-toolkit/pull/673)). + ## [3.5.0]