The secret was to replace class with struct. Then everything worked as desired. Thanks to lorem ipsum!
Here is the (slightly) adjusted code:
struct Limit {
var value: Int
var from: Double
var to: Double
init(value: Int, from: Double, to: Double) {
self.value = value
self.from = from
self.to = to
}
}