I am trying to create a singleton class. Unable to initialize value. here is my code -
import UIKit
class SHProxy: NSObject {
static let sharedInstance = SHProxy()
var questionClickCount = 0
var overlayView : UIView
private override init() {
overlayView = loadOverLayView() //Error is in this line
}
private func loadOverLayView() -> UIView{
let nibName = NSBundle.mainBundle().loadNibNamed("SHOverlayView", owner: self, options: nil)
return nibName[0] as! UIView
}
}
Error: Use of self In method call "loadOverLayView" before super.init initialize self