-2

I am using a common class for my app and an extension Today.

I am also using a preprocessor macro: iOS 8 Extension How To Detect Running.

How can I get a instance of UITodayViewController?

 #if WIDGET
    // here       
 #else
    //....
 #endif
7vasko
  • 1
  • 2
  • Possible duplicate of [Singleton with properties in Swift 3](https://stackoverflow.com/questions/37953317/singleton-with-properties-in-swift-3) – Ashwin Sathawane Dec 01 '17 at 06:26

1 Answers1

0

If your asking how to make a singleton from a UIViewController:

Add a static instance to an extension.

extension UITodayViewController {
    static let shared = UITodayViewController()
}
efremidze
  • 2,410
  • 1
  • 21
  • 34