This is a Xcode 14/Swift 5.7 playground based on the Coding Curves series of articles.
I've tried to stay close to the source material, so I haven't used automatically flipped drawing contexts. All drawing is done in NSImages, which you can reveal with quick look from the right margin.