Your class cell works is a reference type. What does that mean ?
Well, Apple's explanation about the topic is quite sufficient :
Types in Swift fall into one of two categories: first, “value types”,
where each instance keeps a unique copy of its data, usually defined
as a struct, enum, or tuple. The second, “reference types”, where
instances share a single copy of the data, and the type is usually
defined as a class. In this post we explore the merits of value and
reference types, and how to choose between them.
By declaring cell as a class, this is a reference type.
Refence type
// let's create an object
let cell1 = Cell()
// now we add a reference to this object
let cell2 = cell1
// now we change the top of cell1
cell1.up = 10
NSLog("\(cell2.up)")
// -> outputs : 10
// Since cell1 and cell2 represents the same object,
// you can't modify cell1 without modifying ce22.
What happen if you declares cell as a structinstead of a class? It becomes a value type :
Value type
// let's create an object
let cell1 = Cell()
// now we create a new object, cell2, with the value initialized
// with cell1's value. It's a copie, not a reference
let cell2 = cell1
// now we change the top of cell1
cell1.up = 10
NSLog("\(cell2.up)")
// -> outputs : 0
// Here cell1 and cell2 are totally different objects
cellastructinstead of aclass.