Understanding swift defer statement
Defer statement in swift is executed just before the control exits the scope in which defer is defined. Swift’s official document states
Defer statement in swift is executed just before the control exits the scope in which defer is defined. Swift’s official document states
When you want to ensure that a code block is executed just before control exits the scope, Swift Defer Statement comes to your rescue. Sometimes a function is required to have multiple conditional exit point and covering those exit points without swift defer statement can lead to code duplication or it might just not be possible to … Read more