The problem is inherently object oriented. Analysis of the problem will reveal how inherently object oriented it is. We have one large object called equation and other objects which the equation contains like text, sqrt, supersript, subscript, brace etc. These elements like sqrt, superscript, subscript in turn contain a collection of equations. Therefore the whole equation can be represented as a tree with node being objects.
All node have some common properties and some properties which are overriden for specific objects.
The different elements like brace, squareroot have some common behaviour with some specific eccentricities. Each equation element shows a different set of local properties. The internal working of Swift makes extensive use of polymorphisms allowed by Java. The java lang class Vector is very useful because it can store classes of different types and is a dynamically automatically resizing array ie as and when elements are added the size is adjusted to accomodate the elemtns. Each element like brace, integral etc is a derived class of baseclass and they override the putequation method.