[swift-users] module (de)-initialization

Mr Bee pak.lebah at yahoo.com
Mon Dec 19 02:37:21 CST 2016


Hi all,
As I learn Swift, I got 2 questions here:
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?
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:
var i = 5for i in 1...10 {  let i = 10  print(i)}
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.
Thank you.
Regards, 
–Mr Bee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20161219/634b3026/attachment.html>


More information about the swift-users mailing list