Q:

Swift- Use data through app

I am developing a quote of the day app so I created a quote class:
import Foundation
class Quote {
  let quote: String?
  let author: String?
  let backgroundImage: UIImage?
}

Then I created a loading screen that fetches the quote of the day data from an external database and creates a new instance from class Quote with the data fecthed:
import UIKit
import Parse
class LoadingViewController: UIViewController {

  override func viewDidLoad() {
    super.viewDidLoad()
    //
    //check for internet connection and fecth data
    //
    //assign each data to a variable of quote object 
    ///q, a and bI are variables that represents quote, author and image

    let quoteOfTheDay = Quote()
    quoteOfTheDay.quote = q
    quoteOfTheDay.author = a
    quoteOfTheDay.backgroundImage = bI

    //---perform segue to main view controller
  }

}

After that, I want to share this quote of the day instance with all my other viewControllers until my app terminates. If it quits, the user will be directed to the loading view controller again to get the data. Otherwise, this quoteOfTheDay instance needs to stay active and be used by other screens as if it was cached while the app is active. How can I do this? 
Note that I don't want to keep passing this instance with the use of prepareForSegue.
Thank You!

A:

You can use a singleton like this:
import Foundation
class Quote {
  let quote: String?
  let author: String?
  let backgroundImage: UIImage?

  class var sharedInstance: Quote {
    struct Singleton {
      static let instance = Quote()
    }
    return Singleton.instance
  }
}

Now you can just call
Quote.sharedInstance

More details about design patterns in swift here
You will find a lot of code demos for singleton in here
@rmaddy and @adamPro raise important aspects I forgot to mention: 

You must be careful with this designer as it stays in memory for the
life of your application (so no load images and videos here, and do
not abuse this kind of designer too) 
Also as the name suggest you can    just create one instance of a singleton, if you think you may need to    in the future you should
look for a more appropriate method to use
Singletons does not have a very good view in most of the apple community, seems that this is changing with swift, however it is vastly used in other languages 

