Skip to main content
Version: 1.14


As stated on the official website:

Swift is a general-purpose programming language that’s approachable for newcomers and powerful for experts. It is fast, modern, safe, and a joy to write.

The swift compiler doesn't yet have WebAssembly support, however the SwiftWasm project provides a patched compiler with this capability.

The SwiftWasm team is working to merge these changes into the Swift project. In the meantime, you can use the tool chain provided by the SwiftWasm project to build Kubewarden policies.


You don't need an Apple system to write or run Swift code. Everything can be done also on a Linux machine or on Windows (by using Docker for Windows).

Current State

Policy authors can use the following resources:

  • Kubewarden Swift SDK: this provides a set of structs and functions that simplify the process of writing policies.
  • Kubewarden Swift template project: use this template to scaffold a Swift-based policy. The template comes with a working policy and a set of GitHub Actions to automate its lifecycle.

There are no severe limitations with Swift, only some minor issues:

  • It's critical to perform some post-build optimizations before using the policy "in production":
    1. Strip the Wasm module via wasm-strip to reduce its size
    2. Optimize the Wasm module via wasm-opt

The GitHub Action provided by the template repository already takes care of that.

More examples

This GitHub repository branch has a Kubewarden Policy written in Swift.