Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
In support to blog post
class HTMLElement {
let name: String
let text: String?
lazy var asHTML: () -> String = {
return "<\(>\(self.text)</\(>"
init(name: String, text: String? = nil) { = name
self.text = text
deinit {
print("HTMLElement \(name) is being deinitialized")
var paragraph: HTMLElement? = HTMLElement(name: "p", text: "hello, world")
paragraph = nil
// Output:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment