iOS get stuck in instantiation dependency without failing
<p>If I've something that looks like</p>

<pre><code>class Foo {
  static shared = Foo()
  init() {
    print("init Foo")
    let _ = Bar.shared
  }
}

class Bar {
  static shared = Bar()
  init() {
    print("init Bar")
    let _ = Foo.shared
  }
}

// somwehere else:
let _ = Foo.shared
</code></pre>

<p>then the app gets stuck. Nothing happens. I understand that this design is wrong, but I'm wondering why the app is not crashing, reporting an error or at least printing a loop. The above code print</p>

<pre><code>init Foo
init Bar
</code></pre>

<p>and that's it, showing that it is not looping but just getting stuck. An idea on what's happening?</p>