Why I Use Swift To Make Generative Art
Now that I am retired from programming for a living, I make generative art (not AI; see my post What Is Generative Art?) every day. I belong to a discord community of generative artists, yet I stick out because I am the only person using Swift as my chosen language. Others may be out there, but I have never found another one.
Most generative artists use Javascript (often with a framework called p5.js), a few use Java (often with p5's ancestor Processing), and Python and C++ are occasional options.
So why Swift? Firstly, I exclusively wrote in Swift from 2015 to 2021 in my final job, so I was very familiar with it. I prefer Swift to all other programming languages I used during my four decades (Basic, APL, Assembly, Pascal, C, C++, Objective-C, Java, PHP, Ruby, and Javascript). Modern syntax, constant improvements, decent performance, and language features making quality more straightforward to achieve made me appreciate it during all those years working on strategically important iOS code.
When I started that final job, everything was written in Objective-C, and executives were reluctant to allow Swift in. My manager at the time and I devised a way to encourage acceptance by telling them that Apple wanted new code written in Swift and would eventually no longer approve apps only written in Objective-C, and they believed us. Sometimes, fooling executives is easy!
Building iOS apps in Swift makes sense, but why create art with it? After retirement, I briefly looked at Processing and p5.js, but the idea of using Java or Javascript was not appealing. Using a popular prebuilt framework would limit my opportunities to differentiate my art. I know of people who use Vanilla Javascript for this reason.
I use only a couple of data structure open-source libraries and stick to MacOS frameworks like Core Image, Core Graphics, and GamePlayKit. Every other algorithm is devised by me. With Swift's decent performance and a 20-core Mac Studio, I get all the speed I need. Most of my generated images are from 50 to 200+ megapixels in size. So far, I have not felt a need to use Metal, as my CPU-based code is fast enough. If I ever venture into making animations, I might add that.
People who target NFTs as the result of generative art mostly have to use Javascript and p5.js, as NFT selling sites assume this if you want to dynamically generate new works instead of simply uploading a static result. In my process, generation is supplemented by many manual processes, including image manipulation, digital painting, and occasionally even AI (but never used directly since it can only make tiny 1-megapixel images). While my art is highly varied, to me, they are all accomplished by a similar process but with many different tools and options.
To people who view my art and understand generative art, I am so far out in left field that I am not even in the stadium (to use a baseball metaphor). That's the whole point of my art: going as far out as I can go and still making something you can hang on a wall. Someday, the art world might even see it; so far, it's been primarily programmers!
Swift isn't perfect, but neither is any programming language; you try to pick something you are comfortable with and gets the job done. I chose Swift for its strengths, familiarity to me, and thus the ability to try things out in code quickly and keep what works. I no longer care about shipping code to the world; I only care about the output.
Note that I am not associated with Apple in any way (despite having worked there in the bad old days from 1995 to 1996). Like anyone else, I am still trying to get a response from Developer Tech Support to my question. Some things even Swift can't do!
Please see the art on my website.