Mon moteur Swift

So a long, long time ago I developed some technology for an awesome company, for an awesome project. I wrote this in Java using Processing, a really amazing IDE which I recommend everybody should use at least once. In previous years I had bought a book titled Sams Teach Yourself C++ in 10 minutes which sparked my interest in OOP so this new challenge became a personal and technical exploration. Looking back it represents my departure from other mainstream environments.

Any hoot, the basic core requirements for this technology were to draw and animate 3D objects so after some highly intense research I designed and developed a very primitive scene graph which exposed parameters. Most importantly it proved to be successful, most interestingly because it was versatile. Food for my brain.

I later built another more mature version in Objective-C which sits behind iSnowglobe.

Which moves me on to the present-day. Firstly I must admit when I heard of Swift my initials thoughts were not so positive, thankfully we are now developing a strong relationship. It’s been frustrating at times but we’re cool, DUDE, SWEET.

I have this project I started, a game which I have been developing for what feels like a 1000 years, so I smashed my head against a brutally resistant wall a few times and thought I know, this is a great opportunity to learn Swift. Usually I find practicality always throws up unexpected things and I prefer to apply myself constructively. So now I’m writing a cleaner version and felt like sharing some experience.

Figure 1
Figure 1

Looking at the diagram (Figure 1) one can observe at the heart lies a simple hierarchy which describes a dynamic data-set abstracted into discrete core components: properties, parameters and variables. Through research I have discovered this design pattern appears to be a presence in more sophisticated API.

Only a small piece of a larger puzzle is highlighted here but the strength is within clear simplicity. New property-sets can be created using a Property, property-sets contain any number of parameters, the Parameter value is bound to a Variable through closures. Custom subclasses can expose a Variable using ivar(s). Lower down the chain parameters can support animation by evaluating a FunctionCurve at any supported time-frame. Sweet.

During development there were times when I missed the high level of dynamism offered by the Objective-C runtime, no pun intended, but I have realised Swift offers a new world where I can continue to grow and in many ways it feels reminiscent.

As my Swift matures I’m certain this narrative will seed new interesting fruit.