Create embedded software with Swift

Develop efficient, reliable firmware for devices like microcontrollers

  • Safe Eliminate buffer overruns and null‑pointer crashes at compile time, keeping your firmware dependable and robust.
  • Interoperable Reuse existing C/C++ drivers and SDKs with zero wrappers or runtime glue, integrating in minutes.
  • Tiny Produce meaningful programs measured in kilobytes that are capable of running on constrained devices with no hidden overhead.
Get Started

Runs on many embedded platforms

A sample Swift code snippet with a blinking microcontroller next to it
  • Integrate with Raspberry Pi Pico SDK Take advantage of seamless interoperatibility and use existing APIs from the Pico SDK directly from your Swift code. Open guide
  • Go baremetal on STM32 chips For maximum control, you can run completely baremetal and use Swift MMIO to operate hardware devices. Open guide

Embedded Swift is not limited to specific hardware devices or platforms. It's versatile, it can be integrated with existing SDKs and build systems, and it can also be used for pure baremetal development. Most common ARM and RISC-V chips can be targeted by the Swift toolchain.

Learn more about integration with other platforms and build systems

Explore example projects

  • Harmony
    Harmony Bluetooth Speaker Build a Bluetooth speaker with a ferrofluid visualizer using the Raspberry Pi Pico W. Learn more
  • Matter and HomeKit Smart Light
    Matter and HomeKit Smart Light Implement a Matter smart light accessory that can be used from HomeKit, using an ESP32 microcontroller. Learn more
  • Interactive UI Examples Build projects using the popular embedded graphics library LVGL on an STM32 board for rich UI and touch input. Learn more
  • PlaydateKit
    PlaydateKit Create interactive games using PlaydateKit, which provides an easy to use Swift bindings for the Playdate gaming console. Learn more
Explore more Embedded Swift examples and templates on Github

Dive into Embedded Swift

Explore how Embedded Swift tailors Swift’s features like generics, protocols, and async/await into a firmware‑optimized compilation mode that produces compact binaries with predictable performance for bare‑metal devices.

Learn more

Read the blog

  • Variety of embedded development boards
    Get Started with Embedded Swift on Microcontrollers Discover how Swift runs on ARM and RISC-V microcontrollers with real-world examples using the new Embedded Swift compilation mode. Read more
  • Breakout-style grayscale game
    Byte-sized Swift: Building Tiny Games for the Playdate Learn how Swift was used to build tiny games on the Playdate, with full source, hardware demos, and a deep dive into Embedded Swift. Read more
Read more

Ergonomic and performant

Access hardware registers confidently with Swift-MMIO’s type-safe, expressive API. Your Swift code compiles into minimal, efficient machine code—providing the power and correctness embedded developers need.

Learn more
Ergonomic and performant

Squeeze into the smallest places

In just 788 bytes of resulting compiled code, Embedded Swift powers Conway’s Game of Life on the Playdate handheld—melding high‑level abstractions with low‑level bit‑twiddling for real‑time animation.

Learn more
/// Updates each pixel of the current row based on
/// the surrounding rows in the previous frame.
func update(above: Row, current: Row, below: Row) {
  var byte: UInt8 = 0
  var bitPosition: UInt8 = 0x80
  for column in 0..<Frame.columns {
    let sum = above.sum(at: column)
      + current.middleSum(at: column)
      + below.sum(at: column)
    let isOn = current.isOn(at: column)
    if sum == 3 || (isOn && sum == 2) {
      byte |= bitPosition
    }
    bitPosition >>= 1
    if bitPosition == 0 {
      self[Int(column / 8)] = ~byte
      byte = 0
      bitPosition = 0x80
    }
  } 
}
A playdate device