title: Delegation of singleton class in Swift
body: <p>How to use delegate methods of singleton/shared class?
  There is one singleton class having some protocol defined but I'm not getting how to access the delegate functions in other classes.</p>
  
  <p>Code snippet for a reference (swift):</p>
  
  <blockquote>
  <pre><code>protocol AClassDelegate
  {
    func method1()
  }
  
  class A
  {
     static let shared = A()
  
     override init() {
       //initialisation of member variables
     }
  
     var delegate: AClassDelegate
     func foo() {
  
     }
  }
  
  
  class B: AClassDelegate
  {
     func bar() {
        // Note: not getting call to 'foo' method of class 'A'
        A.shared.delegate = self
        A.shared.foo()
     }
  }
  </code></pre>
  </blockquote>
  
  <p>Is this implementation correct?</p>