Simo Virokannas

Writings and ramblings

Category: Swift

  • Adding resizing and resizable subviews to NSView

    If you’re adding a subview programmatically, you may run into having to constantly set all the resizing behaviors and/or anchors manually when all you really want to do is fill the whole available area based on two options: “stretch me to fit this box” or “stretch this box so I can fit”. This happens especially…

  • Spline interpolation in Swift

    Just so that the next person can avoid having to do the wikipedia-math-formula-to-Swift conversion, here’s a simple Catmull-Rom interpolation method for linear y=x data. I’m using it to create simple ski jump hill profiles for a possibly upcoming game, it’s so easy to describe a hill profile by just giving it control points and let…