<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1482136021777_3194"><span>Hi all,</span></div><div id="yui_3_16_0_ym19_1_1482136021777_3194"><span><br></span></div><div id="yui_3_16_0_ym19_1_1482136021777_3194">As I learn Swift, I got 2 questions here:</div><div id="yui_3_16_0_ym19_1_1482136021777_3194"><br></div><div id="yui_3_16_0_ym19_1_1482136021777_3194" dir="ltr">1. Is there any module initialization and deinitialization concept in Swift (v.3)? For example, upon loading a module, I want that module to do something before being utilized (initialization) or after being utilized (deinitialization). If there is, is there any example of how to do that?</div><div id="yui_3_16_0_ym19_1_1482136021777_3194" dir="ltr"><br></div><div id="yui_3_16_0_ym19_1_1482136021777_3194" dir="ltr">2. If within a scope, I'd like to access to an instance or variable out of current scope which having an exact name, is it possible? Consider this code:</div><div id="yui_3_16_0_ym19_1_1482136021777_3194" dir="ltr"><br></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Menlo;" id="yui_3_16_0_ym19_1_1482136021777_3539"><span style="font-variant-ligatures: no-common-ligatures; color: #35568a" id="yui_3_16_0_ym19_1_1482136021777_3540">var</span><span style="font-variant-ligatures: no-common-ligatures" id="yui_3_16_0_ym19_1_1482136021777_3541"> i = </span><span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" id="yui_3_16_0_ym19_1_1482136021777_3542">5</span></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Menlo;" id="yui_3_16_0_ym19_1_1482136021777_3543"><span style="font-variant-ligatures: no-common-ligatures; color: #35568a" id="yui_3_16_0_ym19_1_1482136021777_3544">for</span><span style="font-variant-ligatures: no-common-ligatures" id="yui_3_16_0_ym19_1_1482136021777_3545"> i </span><span style="font-variant-ligatures: no-common-ligatures; color: #35568a" id="yui_3_16_0_ym19_1_1482136021777_3546">in</span><span style="font-variant-ligatures: no-common-ligatures" id="yui_3_16_0_ym19_1_1482136021777_3547"> </span><span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" id="yui_3_16_0_ym19_1_1482136021777_3548">1</span><span style="font-variant-ligatures: no-common-ligatures" id="yui_3_16_0_ym19_1_1482136021777_3549">...</span><span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" id="yui_3_16_0_ym19_1_1482136021777_3550">10</span><span style="font-variant-ligatures: no-common-ligatures" id="yui_3_16_0_ym19_1_1482136021777_3551"> {</span></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Menlo;" id="yui_3_16_0_ym19_1_1482136021777_3552"><span style="font-variant-ligatures: no-common-ligatures" id="yui_3_16_0_ym19_1_1482136021777_3553">&nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #35568a" id="yui_3_16_0_ym19_1_1482136021777_3554">let</span><span style="font-variant-ligatures: no-common-ligatures" id="yui_3_16_0_ym19_1_1482136021777_3555"> i = </span><span style="font-variant-ligatures: no-common-ligatures; color: #0433ff" id="yui_3_16_0_ym19_1_1482136021777_3556">10</span></div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Menlo;" id="yui_3_16_0_ym19_1_1482136021777_3557"><span style="font-variant-ligatures: no-common-ligatures" id="yui_3_16_0_ym19_1_1482136021777_3558">&nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #587ea8" id="yui_3_16_0_ym19_1_1482136021777_3559">print</span><span style="font-variant-ligatures: no-common-ligatures" id="yui_3_16_0_ym19_1_1482136021777_3560">(i)</span></div><div id="yui_3_16_0_ym19_1_1482136021777_3194" dir="ltr">



</div><div style="margin-top: 0px; margin-bottom: 0px; font-size: 12px; line-height: normal; font-family: Menlo;" id="yui_3_16_0_ym19_1_1482136021777_3561"><span style="font-variant-ligatures: no-common-ligatures" id="yui_3_16_0_ym19_1_1482136021777_3562">}</span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1482136021777_3563"><span style="font-variant-ligatures: no-common-ligatures" id="yui_3_16_0_ym19_1_1482136021777_3564"><br id="yui_3_16_0_ym19_1_1482136021777_3565"></span></div><div dir="ltr" id="yui_3_16_0_ym19_1_1482136021777_3563">Is there a way to print the 'i' of the let, and the 'i' of the loop, and the 'i' of the var, from inside of the for loop? I know it's a bad practice, but I'm just curious.</div><div dir="ltr" id="yui_3_16_0_ym19_1_1482136021777_3563"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1482136021777_3563">Thank you.</div><div dir="ltr" id="yui_3_16_0_ym19_1_1482136021777_3563"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1482136021777_3563">Regards,</div><div></div><div id="yui_3_16_0_ym19_1_1482136021777_3480">&nbsp;</div><div class="signature" id="yui_3_16_0_ym19_1_1482136021777_3223"><div id="yui_3_16_0_ym19_1_1482136021777_3222"><br></div>–Mr Bee<div id="yui_3_16_0_ym19_1_1482136021777_3228"><br></div></div></div></body></html>