Reference cycles with value types?

后端 未结 6 1400
太阳男子
太阳男子 2020-12-03 08:34

Reference cycles in Swift occur when properties of reference types have strong ownership of each other (or with closures).

Is there, however, a possibility of havin

6条回答
  •  旧巷少年郎
    2020-12-03 08:47

    Quick and easy hack workaround: just embed it in an array.

    struct A {
      var otherA: [A]? = nil
      init() {
        otherA = [A()]
      }
    }
    

提交回复
热议问题