Sponsored By

Want to Learn Embedded Swift Programming?

SwiftIO Playground is ideal for dipping one’s toes in the Swift programming waters.

Clive 'Max' Maxfield

September 16, 2023

6 Min Read
Image courtesy of MadMachine.io

Before we plunge into the fray with gusto and abandon (and aplomb, of course), I should remind you that I’m a hardware design engineer by trade. I can write software, but I’ve never captured any code I’d want to show to my dear old mother.

Over the years, I’ve dabbled in various flavors of assembly language, along with BASIC, FORTRAN, and Pascal. Currently, I write most of the programs for my hobby projects using the Arduino implementation of C/C++. Once again, however, I’d be ashamed to show you my code (I’d rather have you laughing with me than at me). The point I wish to make is that you should take anything I say about software with a proverbial “grain of salt.”

Having said all this … take a deep breath and hold onto your hat because I’m about to waffle about software. Let’s start with the fact that I’m always amazed by the number of programming languages that are roaming wild and free. If you look at the List of Programming Languages on the Wikipedia, you’ll see there are 49 that start with the letter ‘A’ alone. Amazingly enough, this list restricts itself to what it calls “notable programming languages in current or historical use.” I’m scared to think how many un-notable languages are out there.

Furthermore, I’m certainly not going to mention any Esoteric Programming Languages,* because even mentioning the names of these little rascals could lead us down a rabbit hole. The last thing we need is to spend hours trying to wrap our brains around offerings like Befunge (which allows the instruction pointer to roam in multiple dimensions through the code), Chicken (which has just three tokens, one of which is the word “chicken”), Malbolge (in which code is self-modifying by design and the effect of an instruction depends on its address in memory), and Whitespace (which uses only the whitespace characters: space, tab, and return). *You’re welcome.

Two languages we will mention that are increasing in popularity amongst the embedded developer community are Rust, which was created by the Mozilla Foundation and the open-source community, and Swift, which was created by Apple and the open-source community.

For reasons that will become clear momentarily, we will be focusing on Swift for the purpose of these discussions. Swift is described as an intuitive, imperative, general-purpose, multi-paradigm, compiled programming language (I know what “intuitive,” “general-purpose,” and “compiled” mean, but the other descriptors are up for grabs as far as I’m concerned).

Most people, if they think of Swift at all, think of it in the context of building apps for things like the iOS  and macOS operating systems to run on iPhone, iPad, Apple TV, and Apple Watch devices. However, on the basis that Swift is both easy to use and open source, there’s increasing interest in using it on microcontroller units (MCUs) for embedded applications.

So, where do you go if you want to learn how to program in Swift? Well, by golly, I’m glad you asked. I was just chatting with Andy Liu from MadMachine. Andy is the designer of the SwiftIO Micro, which features a 32-bit Arm Cortex-M7 processor core presented in the form of an NXP RT1062 microcontroller device running at 600 MHz. When you think about it, this was the high-end clock frequency for mainstream PCs circa the year 2000. Give me strength!


In addition to flaunting 32 MB of RAM and 16 MB of Flash (tears of joy are rolling down my cheeks as I pen these words), the SwiftIO Micro boasts 44 user-accessible pins, including digital I/O, analog inputs, and PWM, UART, SPI, I²C, and I²S interfaces.

So, how do we go about programming this beast? Well, as Andy told me: “On the software side, embedded developers have traditionally been obliged to use C or limited C++ on bare-metal hardware. There haven’t been many modern programming languages designed specifically for microcontrollers. In recent years, however, both Rust and Swift have emerged with ambitions to replace C/C++. These languages take different approaches. Rust requires developers to be experts in low-level details to write their code. By comparison, Swift is both approachable for newcomers and powerful for experts. This is precisely why we chose Swift for our project. We want people to be able to develop interesting applications without struggling with the low-level details.”

The reason I’m waffling on about all of this here is that—just a couple of days ago as I pen these words—the guys and gals at MadMachine launched their SwiftIO Playground project on CrowdSupply.


The SwiftIO Playground includes the SwiftIO Micro, which is located in the upper-middle of the Playground’s printed circuit board (PCB). The main Playground board features a host of smaller pre-wired modules, thereby eliminating the need for soldering or debugging hardware connections.

In addition to the usual suspects in the form of LEDs, potentiometers, and pushbuttons, there are accelerometer, buzzer, speaker, LCD, and real time clock (RTC) modules, along with… the list continues. All you need do is use a USB cable to connect your SwiftIO Playground to your host computer, and “Bob’s your uncle,”* as they say (*or aunt, depending on your family dynamic).


On the downside, one thing we should note is that—at the time of this writing—MadMachine’s Software Development Kit (SDK) currently supports only the macOS and Linux operating systems (sad face). The folks at MadMachine say that Swift’s Window support is evolving in general, and that support for Windows is on MadMachine’s roadmap.

On the bright side, SwiftIO Playground is augmented with a cornucopia of detailed tutorials and a plethora of demo projects to get you up and running (happy face).

The asking price for this project is a very reasonable $108. This includes free shipping in the US (shipping to the rest of the world is an extra $12).

MadMachine is a small company. It has to be acknowledged that there’s a risk here because transitioning from a working prototype to a full production run can bring the strongest amongst our number to their knees. On the other hand, I love the enthusiasm of young engineers and I really want this project to (a) be funded and (b) succeed, not least that I now find I have the urge to learn how to program in Swift. I can imagine chatting casually to my software developer friends at conferences: “What? You still program in Rust? That’s so early 21st Century, my dear [chuckle]. All the with-it folks [like me] are programming in Swift!”

How about you? Do you have any thoughts you’d care to share on anything you’ve read here?

About the Author(s)

Clive 'Max' Maxfield

Clive "Max" Maxfield is a freelance technical consultant and writer. Max received his BSc in Control Engineering in 1980 from Sheffield Hallam University, England and began his career as a designer of central processing units (CPUs) for mainframe computers. Over the years, Max has designed everything from silicon chips to circuit boards and from brainwave amplifiers to Steampunk Prognostication Engines (don't ask). He has also been at the forefront of Electronic Design Automation (EDA) for more than 35 years.

Well-known throughout the embedded, electronics, semiconductor, and EDA industries, Max has presented papers at numerous technical conferences around the world, including North and South America, Europe, India, China, Korea, and Taiwan. He has given keynote presentations at the PCB West conference in the USA and the FPGA Forum in Norway. He's also been invited to give guest lectures at several universities in the US and at Oslo University in Norway. In 2001, Max "shared the stage" at a conference in Hawaii with former Speaker of the House, "Newt" Gingrich.

Max is the author and/or co-author of a number of books, including Designus Maximus Unleashed (banned in Alabama), Bebop to the Boolean Boogie (An Unconventional Guide to Electronics), EDA: Where Electronics Begins, FPGAs: Instant Access, and How Computers Do Math.

Sign up for the Design News Daily newsletter.

You May Also Like