Server-side Swift is transforming the landscape of web development by bringing the speed, safety, and modern syntax of Swift to backend programming.
The backend of IndiePitcher itself is built with Swift and we provide an official SDK to make it easy to integrate IndiePitcher with your server-side Swift apps.
Though it is technically possible, we don’t recommend using the SDK from client iOS/macOS apps. You’re risking your secret API key being exposed.
The risk is lower than with client-side JavaScript, but it’s still there. You can easily set up an AWS lambda function to send an email on behalf of your app.
This will give you easy access to the SDK methods using application and request.
app.get { req async in let emailBody = """ This is a sample body that supports **markdown**. HTML is also supported. """ try await indiePitcher.sendEmail( data: .init( to: "petr@indiepitcher.com", subject: "Hello from Vapor!", body: emailBody, bodyFormat: .markdown)) return "ok"}