Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any example of using weak self? #91

Closed
harryworld opened this issue May 7, 2015 · 1 comment
Closed

Any example of using weak self? #91

harryworld opened this issue May 7, 2015 · 1 comment

Comments

@harryworld
Copy link

For example:

func anotherFunction(value: String) {
}

myFunction { [weak self] in 
  if let wself = self {
    print(wself.title)
    anotherFunction(wself.property)
  }
}
@gregheo
Copy link
Contributor

gregheo commented May 7, 2015

That's definitely the way to specify other-than-strong references for closure expressions. I'm not sure there's any debate on that so it isn't in the style guide – it's not meant to be a complete encyclopedia with every bit of syntax; just on the stuff we argue about. ;]

@gregheo gregheo closed this as completed May 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants