0

I need an array that is accessible through out my app. It will hold objects of Type ClassA. I need to add/remove elements and access this array from multiple scenes.

What is the best or recommended method for building this singleton type class in Swift?

Or has Swift even come up with something for this yet?

4thSpace
  • 43,672
  • 97
  • 296
  • 475
  • Look at [this answer](http://stackoverflow.com/a/24147830/148357) which also covers swift 1.2 – Antonio Apr 10 '15 at 16:13
  • He wrong with the first example in that post. You can't use a static that way in Xcode 6.2 (note sure what version of Swift that is). – 4thSpace Apr 10 '15 at 16:18
  • the direct link to the answer I posted above is for Swift 1.2 - if you are using earlier versions, look at the [accepted answer](http://stackoverflow.com/a/24073016/148357) – Antonio Apr 10 '15 at 16:22
  • I see now. Xcode 6.3 is Swift 1.2. Should I delete this question then since no answer will be provided. – 4thSpace Apr 11 '15 at 14:23
  • The question is already marked as duplicate and linked to a question with relevant answers, so leaving doesn't hurt :) – Antonio Apr 11 '15 at 14:26

0 Answers0