In this example, we will show you how to use the CreativeEditor SDK’s CreativeEngine to apply the contents of a given template scene to the currently loaded scene through the scene
API.
Applying Template Scenes
public func applyTemplate(from string: String) async throws
Applies the contents of the given template scene to the currently loaded scene. This loads the template scene while keeping the design unit and page dimensions of the current scene. The content of the pages is automatically adjusted to fit the new dimensions.
string:
: The template scene file contents, a base64 string.
public func applyTemplate(from url: URL) async throws
Applies the contents of the given template scene to the currently loaded scene. This loads the template scene while keeping the design unit and page dimensions of the current scene. The content of the pages is automatically adjusted to fit the new dimensions.
url:
: The url to the template scene file.
Full Code
Here’s the full code:
try await engine.scene.applyTemplate(from: "UBQ1ewoiZm9ybWF0Ij...")try await engine.scene .applyTemplate( from: .init( string: "https://cdn.img.ly/assets/demo/v1/ly.img.template/templates/cesdk_postcard_1.scene" )! )