Use Xcode playgrounds to play with generative art projects. API is UIKit (easier to find answers for on stackoverflow) and CoreGraphics.
To save the images as PDF the directory ~/Documents/Shared Playground Data needs to exist (Xcode won't set it up).
Converted generative art by kovach.me from Haskell and the Cairo rendering engine to XCode playgrounds and CoreGraphics.
My own creation from a failed experiment to recreate something else.