Closed AndrewSB closed 7 years ago
@AndrewSB, sorry for delay! It seems like a Swift bug. Adding type annotation to gradientLayer
might work :)
class GradientView { let colors = ... lazy var gradientLayer: CAGradientLayer = CAGradientLayer().then { $0.colors = self.colors // also tried colors } }
@AndrewSB, Doesn't it work?
It does! Thanks @devxoul!
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?