Become a member
Sign in
Swift Retention Cycle in Closures and Delegate
1.5K
18
Bob Lee
Juan Carlos Castellet Fernández
Juan Carlos Castellet Fernández
Aug 31, 2018 · 1 min read

What happens if you have a weak var, and iterate with a guard let over it, and use it in an scaping closure. Is this modifying the reference count over something?

Ex:

weak var something: Foo?

guard let something = something else { return }

otherThing.saveClosure {

something.more()

}

    Juan Carlos Castellet Fernández

    Written by

    Juan Carlos Castellet Fernández

    Write the first response

    Discover Medium

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

    Make Medium yours

    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

    Become a member

    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade
    AboutHelpLegal