Skip to content

Instantly share code, notes, and snippets.

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