# Chapter 4: delegate pattern without retain cycle explanation?

**URL:** <https://forums.kodeco.com/t/chapter-4-delegate-pattern-without-retain-cycle-explanation/43689>\
**Category:** Design Patterns by Tutorials\
**Created:** [June 18, 2018, 8:41am UTC](https://forums.kodeco.com/t/chapter-4-delegate-pattern-without-retain-cycle-explanation/43689 "2018-06-18T08:41:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomereven](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/tomereven/32/87221_2.png) [@tomereven](https://forums.kodeco.com/u/tomereven)\
**Post date:** [June 18, 2018, 8:41am UTC](https://forums.kodeco.com/t/chapter-4-delegate-pattern-without-retain-cycle-explanation/43689/1 "2018-06-18T08:41:28Z")

</div>

Why don’t you explain that a delegate property needs to be weak to prevent retain cycles?

also, in the example code its not weak which causes a retain cycle

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [June 29, 2018, 3:25pm UTC](https://forums.kodeco.com/t/chapter-4-delegate-pattern-without-retain-cycle-explanation/43689/2 "2018-06-29T15:25:21Z")

</div>

@jrg.developer Can you please help with this when you get a chance? Thank you - much appreciated! :]

---

<div class="post-metadata">

**Author:** ![syedfa](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/syedfa/32/101500_2.png) [@syedfa](https://forums.kodeco.com/u/syedfa)\
**Post date:** [June 29, 2018, 9:01pm UTC](https://forums.kodeco.com/t/chapter-4-delegate-pattern-without-retain-cycle-explanation/43689/3 "2018-06-29T21:01:18Z")

</div>

@tomereven Thanks very much for your question!

In the first paragraph of the chapter, it states:

> An object needing a delegate, also known as the delegating object. It’s the object that has a delegate. The delegate is usually held as a weak property to avoid a retain cycle where the delegating object retains the delegate, which retains the delegating object.

So in fairness, it is mentioned in the chapter, however, to your point, I don’t see the delegate properties in the chapter being designated as weak. This may be an oversight on our part, but I will try to get one of the authors to perhaps clarify this.

Thanks very much for bringing this to our attention!

---

<div class="post-metadata">

**Author:** ![jrg.developer](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/jrg.developer/32/109958_2.png) [@jrg.developer](https://forums.kodeco.com/u/jrg.developer)\
**Post date:** [June 29, 2018, 9:36pm UTC](https://forums.kodeco.com/t/chapter-4-delegate-pattern-without-retain-cycle-explanation/43689/4 "2018-06-29T21:36:27Z")

</div>

@syedfa Thanks for the reply here!

A couple additional notes:

> [@tomereven](#):
>
> Why don’t you explain that a delegate property needs to be weak to prevent retain cycles?

We do mention that delegates can be used to break retain cycles, but it’s a fair point that more emphasis could be placed on this.

> [@tomereven](#):
>
> In the example code its not weak which causes a retain cycle

You’re right. This seems to be an error, and it should indeed be weak.

I’ll get these both included in the next version of the book and released soon.

Thanks for the feedback. 😄
