We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I can't seem to access class variables in my then block:
For example
class GradientView { let colors = ... lazy var gradientLayer = CAGradientLayer().then { $0.colors = self.colors // also tried colors } }
doesn't work, but
class GradientView { let colors = ... lazy var gradientLayer: CAGradientLayer = { let layer = CAGradientLayer() layer.colors = self.colors return layer }() }
does.
Can I repeat my old pattern of accessing instance variables in a lazy init using Then?
The text was updated successfully, but these errors were encountered:
@AndrewSB, sorry for delay! It seems like a Swift bug. Adding type annotation to gradientLayer might work :)
gradientLayer
class GradientView { let colors = ... lazy var gradientLayer: CAGradientLayer = CAGradientLayer().then { $0.colors = self.colors // also tried colors } }
Sorry, something went wrong.
@AndrewSB, Doesn't it work?
It does! Thanks @devxoul!
No branches or pull requests
I can't seem to access class variables in my then block:
For example
doesn't work, but
does.
Can I repeat my old pattern of accessing instance variables in a lazy init using Then?
The text was updated successfully, but these errors were encountered: