Created
June 10, 2016 21:00
-
-
Save jkubicek/1870eae52216a9455b8f2a2061331958 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
struct ExpensiveType { | |
init(name: String) { | |
print("This is expensive: \(name)") | |
} | |
} | |
class MyType { | |
lazy var prop: ExpensiveType = { | |
print(self) | |
return ExpensiveType(name: "E5") | |
}() | |
deinit { | |
print("Deiniting MyType") | |
} | |
} | |
var t: MyType? = MyType() | |
t = nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment