Swift library to build highly customized reports using REST API
Start Free TrialGroupDocs.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:
{{Customer.Name}}
) and optional generation rules written in LINQ‑style syntax.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.
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
AssemblyApi
with your App SID and App Key.TemplateFileInfo
pointing to the uploaded template.AssembleOptions
object with template, data and format.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)