Two singletons referencing each other prevent the initialization from ending
<p>I have a situation where I want to have two singleton objects that hold references to each other.</p>

<p><strong>ManagerA:</strong></p>

<pre><code>import Foundation

class ManagerA: NSObject {

    static let sharedInstance = ManagerA()

    let managerB = ManagerB.sharedInstance

    private override init() {
        super.init()
    }
}
</code></pre>

<p><strong>ManagerB</strong> (in this example symmetric to ManagerA):</p>

<pre><code>import Foundation

class ManagerB: NSObject {

    static let sharedInstance = ManagerB()

    let managerA = ManagerA.sharedInstance

    private override init() {
        super.init()
    }
}
</code></pre>

<p>Manager A is being created in the AppDelegate.
Unfortunately this leads to the ViewController not being shown anymore, so I assume the initialization process is endless.</p>

<p>How can I solve the initialization?</p>

<p>I'd like to stay with the pattern. Both managers are used throughout the app from various places and the singleton pattern seems fit. Yet it'd be useful if they could also directly access each other.</p>