So this is kind of a weird one, and I don't quite understand what is going on...
So I've made a few custom classes/objects (UIViews) within each other like this:
class Example1: UIView {
[properties etc.]
let Test = Example2()
Test.frame = CGRe...
addSubview(Test)
}
class Example2: UIView {
[properties etc.]
}
This all works fine until you add some sort of function to Example2. Then it will run everything multiple times (if you call Example1, Example2 = 1, 2 it will run in this order: 1, 1, 2, 2, 1, 2, 1, 2, 2, 2 ).
The problem with this is that it will create multiple versions of the same object, but with different values as they are calculated somewhere else (the size and position etc.).
I hope I was able to explain my problem like this, otherwise is the entire (quite messy since I've been trying to solve this for a while) code: http://pastebin.com/4D3kt1uN (if you,like you can try and run it in xcode to see what i mean).
Any help is greatly appreciated!