Report Generator for Swift

Swift library to build highly customized reports using REST API

  • GroupDocs.Assembly Cloud for cURL
  • GroupDocs.Assembly Cloud SDK for .NET
  • GroupDocs.Assembly Cloud SDK for Java
  • GroupDocs.Assembly Cloud SDK for C++
  • GroupDocs.Assembly Cloud SDK for Go
  • GroupDocs.Assembly Cloud SDK for Node.js
  • GroupDocs.Assembly Cloud SDK for PHP
  • GroupDocs.Assembly Cloud SDK for Python
  • GroupDocs.Assembly Cloud SDK for Ruby
  • GroupDocs.Assembly Cloud SDK for Swift
Start Free Trial

GroupDocs.Assembly Cloud is a fully managed, REST‑based document‑assembly service that lets developers create richly formatted reports, contracts, invoices, proposals and any other type of document directly from Swift applications. The service works on top of the GroupDocs Cloud Storage – templates and data are uploaded to the cloud, the assembly engine processes them, and the finished document is returned to the client without the need for any local Office installations. This eliminates the overhead of maintaining third‑party libraries, reduces server‑side processing load and guarantees that the latest format support (DOCX, PDF, PPTX, XLSX, HTML, etc.) is always available.

With the Swift SDK the whole workflow fits naturally into the typical iOS/macOS development cycle:

  1. Prepare a template – a Word, Excel, PowerPoint or any supported format that contains placeholders (e.g., {{Customer.Name}}) and optional generation rules written in LINQ‑style syntax.
  2. Create a data source – a JSON or XML file that supplies the values for the placeholders. Complex structures such as arrays can be used to generate tables, charts or repeated sections.
  3. Upload the template to GroupDocs Cloud Storage using a single API call (the SDK handles the multipart request).
  4. Call the Assemble endpoint – pass the cloud path of the template, the data source content, and the desired output format (the output format can differ from the template format, e.g., generate a PDF from a DOCX template).
  5. Receive the assembled document – the service streams the result back; the SDK can save it locally, send it via email, or store it again in Cloud Storage.

The SDK abstracts all HTTP details – you only need to provide your App SID and App Key (personal access tokens). All communication is encrypted with SSL/TLS, error handling follows standard HTTP status codes, and the service complies with industry‑grade security standards. Because the processing is performed in the cloud, the same Swift code works on iPhone, iPad, Mac or any other platform that can execute Swift code and perform network requests.

The following tabs give a concise overview of the features supported by Assembly Cloud for Swift, the full list of document formats, and the operating systems / development tools that are compatible with the SDK.

Document Assembly REST API Features

Cloud‑based document assembly via REST API

Template placeholders for data insertion

LINQ‑style expression binding for XML/JSON

Embed external documents, images, charts

Dynamic lists, tables and conditional blocks

Spreadsheet formulas and calculations

Email body attributes and attachments

Barcode generation (QR, Code128, etc.)

HTML background color styling

Mail‑merge for batch personalized letters

SSL/TLS secured data transfer

Upload templates to Cloud Storage

Generate a document in Swift

The snippet below demonstrates how to generate a report using the Assembly Cloud SDK for Swift. It uploads a template, reads a data file, configures assembly options and invokes the API.

Steps

  1. Initialise the AssemblyApi with your App SID and App Key.
  2. Upload the template document to Cloud Storage.
  3. Load the report data (XML/JSON) from a local file.
  4. Create TemplateFileInfo pointing to the uploaded template.
  5. Set the desired output format (e.g., docx).
  6. Build an AssembleOptions object with template, data and format.
  7. Call assembleDocument and obtain the assembled file.
import GroupDocsAssemblyCloud

let assemblyApi = AssemblyApi(appSid: "####################", appKey: "####################")
let fileName = "Input1.docx"
let dataFile = "Input2.docx"

// Upload template
let requestFileContent = InputStream(url: URL(string: fileName)!)!
let uploadDocumentRequest = UploadFileRequest(fileContent: requestFileContent, path: fileName)
_ = try assemblyApi.uploadFile(request: uploadDocumentRequest)

// Prepare template info
let templateFileInfo = TemplateFileInfo()
templateFileInfo.setFilePath(filePath: fileName)

// Load data
let reportData = try String(contentsOfFile: dataFile, encoding: .utf8)

// Assemble options
let assembleOptions = AssembleOptions()
assembleOptions.setTemplateFileInfo(templateFileInfo: templateFileInfo)
assembleOptions.setSaveFormat(saveFormat: "docx")
assembleOptions.setReportData(reportData: reportData)

// Execute assembly
let request = AssembleDocumentRequest(assembleOptions: assembleOptions)
let result = try assemblyApi.assembleDocument(request: request)

Support and Learning Resources

GroupDocs.Assembly Cloud also offers individual document assembly SDKs for other languages as listed below:

  English
5f5c5ef