Skip to content

Instantly share code, notes, and snippets.

@jkubicek
Created June 10, 2016 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkubicek/1870eae52216a9455b8f2a2061331958 to your computer and use it in GitHub Desktop.
Save jkubicek/1870eae52216a9455b8f2a2061331958 to your computer and use it in GitHub Desktop.
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