What's the proper way of using Swift's defer
<p>Swift 2.0 introduced a new keyword: <strong>defer</strong></p>

<p>What's the correct way of using this keyword, and what should I watch out for?</p>

<p>Since swift uses ARC, memory management is usually taken care of automagically. So <strong>defer</strong> would only need to be called for memory management for cases where using legacy low level / non arc calls, correct? </p>

<p>Other cases include file access, I imagine. And in these cases defer would be used for closing the "file pointer". </p>

<p>When should use I use <strong>defer</strong> in the "real-world"(tm) of iOS/OSX development. And when it would be a bad idea to use.</p>