Skip to content

Instantly share code, notes, and snippets.

@TerryCK
Created July 18, 2017 03:05
Show Gist options
  • Save TerryCK/584cce140c83d175f041d79f79d34e33 to your computer and use it in GitHub Desktop.
Save TerryCK/584cce140c83d175f041d79f79d34e33 to your computer and use it in GitHub Desktop.
lazy var asHTML: () -> String = {
[weak self] in
guard let this = self else { return "" }
return "<\(this.name)>\(this.text)</\(this.name)>"
}
//換個角度來看self,先用guard let 安全的解包 optional self,在來使用this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment