For such things, you can use class variables. The code will look like this:
class var width = 200.0 class var height = 30.0 class var widthheight = width - height
But when you try, you will see a compiler error:
Class variables are not yet supported
I assume that they have not yet implemented this feature. But at the moment there is a solution. Just move your declarations outside the class declaration, for example:
let width = 200.0 let height = 30.0 let widthheight = width - height class YourClass { ...
source share