I am trying to copy an array from one view controller to another view controller, but somehow it does not work.. I have tried using this code:
let otherVC = TerningspilletViewController()
mineSpillere = otherVC.mineSpillere2
println("otherVC")
In the view controller i want to send the data from has this code:
var mineSpillere = ["Spiller 1", "Spiller 2", "Spiller 3"]
The view controller that is going to received this data, has this code:
var mineSpillere2 = [String]()
the "var mineSpillere" is going to show the text, but when i try to show it, it says that the "var mineSpillere" is empty. Any suggestions/ideas?
mineSpillere = otherVC.mineSpillere2tootherVC.mineSpillere2if you want to assign to mineSpillere2?var mineSpillere2 = [String]()make sure it's outside of the methods and maybe think about using a!or?var mineSpillereis assigned the value ofotherVC.mineSpillere2which doesn't hold any data.