Hi,
I am exploring Closures and trying to understand how they works. Closure have a special key feature that they can capture the context of the variables/constants from surroundings, once captured we can still use them inside the closure even if the scope in which they are defined does not exist.
I want to understand the lifecycle of captured variable/constant i.e., where are these captured variables stored and when these get created and destroyed.
How is memory managed for captured variables or constants in a closure, depending on whether they are value types or reference types?
Topic:
Programming Languages
SubTopic:
Swift