Skip to content

Instantly share code, notes, and snippets.

@externvoid
Last active December 22, 2015 00:19
Show Gist options
  • Select an option

  • Save externvoid/dd6ffbf53cf125126ca9 to your computer and use it in GitHub Desktop.

Select an option

Save externvoid/dd6ffbf53cf125126ca9 to your computer and use it in GitHub Desktop.
class Bar {
let someVal = 5
lazy var g:() -> String = { [unowned self] in
// lazy: 次のエラー対策:error: use of unresolved identifier 'self'
return String(self.someVal)
}
}
var bar = Bar()
print(bar.g()) // string "5"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment