As answered here, create a class function. I've added the full code.
class MyClass {
var x: String
var y: String
class func createY(x: String) -> String {
return x + "_test" // this computation could be much more complex
}
init(x: String) {
self.x = x
self.y = MyClass.createY(x)
}
}